Lets run something to get the feel first.
If you are reading this in a browser, then just press
F12 in Linux or Windows or
⌘ + ⌥ + I . If you prefer using mouse , then right click anywhere in the page and select
Most of the times I will try to give a code snippet in the page itself which can be run directly. Here is one such code snippet printing 'Hello world !!'.
console.log prints in the console whatever we give it to print. You can run this in your browser console to play around.
There are many ways to run. Few of them
Inside script tag of a HTML code . The output appears in the console.
node abc.jsif the code exists in a file named
undefinedprinted at the end
This is special behaviour of the console. You dont know need to know this if its not burning you.
By placing a string at the end we are returning that value. This is specific behaviour of the console. Dont worry much about it.