Sounds confusing, but things will get more clear if you have time and play with it. 😅
Greeting in Browser Console
In order to open your browser’s console from Chrome, in Windows, open Chrome browser and type,
ctrl+shift+i (On Mac is
When you open up the console, you will see something like this. Ignore everything else at this time, focusing on the console tab:
The environment that we have complete control over, but its contents don’t spill into the outside world – that’s why we use a
Now let’s try to do some cool stuff. In your console, type:
As can be observed, the duty
Not only do we
console which are
Now in your console type something similar to this:
As the name of this,
console.warn() method warns developers when they were trying to make a not wise decision and also plus a symbol and some yellow messages.
Likewise, in your console type:
console.error("This is not exactly an error, but I just did it for fun");
Now let’s do something a little cooler, say Hello World with a box that appears!
Whoo-wee…an alert box just appeared in your window with some specified messages and an OK button. That is the function of the alert method.
What is a comment and why it is essential to our code?
// Just one to comment one line.
/* I want to write a comment more than 1 lines, so I write a comment like this, but I still have to write something else because I want it lasts a little more longer. */
Everything in the inside comment will not be displayed, for example:
Yeah, as you can see, nothing seems to appear (don’t care about
/* */in one line:
/* This is a comment */
But if you trying to make some notes in your source code without the syntax above, this will lead to an error: