- A computer with common browsers (recommend Google Chrome or FireFox).
- A little bit or some basic HTML and CSS knowledge. (optional)
Looks like a little bit dumb, but it will be more transparent when you take time with it. 😅
Now let get started…
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 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
Whoo-wee, 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 appears!
Whoo-wee…an alert box just appeared in your window with some specified messages and an OK button. That is the function of alert method.
Practice: Try to write some special messages with all of these methods just mentioned above – the best way to remember something is practice with it.
What is 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 these syntax above, this will lead to an error:
Of course, not.
Practice: Try to write 5 or more comments about whatever you want using both