Greeting JavaScript: Hello World!6 min read

Undeniably, JavaScript is the most popular programming language according to Stack Overflow Survey 2018. As a consequence, it’s a great choice to start with this language. It runs almost every single webpage you’re currently visiting, easy to learn, not just front-end and also back-end development, mobile, desktop, game application, high in-demand in the job market and more…These are the number of reasons why I talk about JavaScript. If you are a newbie and want to learn JavaScript, this series is right for you. We’ll cover from the very first steps with the easiest way to make thing clear. Yet, I still have some requirement: 😅

  • A computer with common browsers (recommend Google Chrome or FireFox).
  • A little bit or some basic HTML and CSS knowledge. (optional)
  • Focusing

But wait a second, what is JavaScript? Don’t confuse between Java and JavaScript, they are 2 completely different programming languages.

In technobabble, JavaScript often abbreviated as JS, is a high-levelinterpreted programming language that conforms to the ECMAScript specification. It is a language that is also characterized as dynamicweakly typedprototype-based and multi-paradigm.

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

JavaScript is the programming language that has been designed to run mainly on the web browser. At first, IDEs are not necessary to run JavaScript files, you can write, run and debug your JavaScript on your own browser.

In order to open your browser’s console from Chrome, in Windows, open Chrome browser and type, ctrl+shift+i (On Mac is cmd+option+j).

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 console to handle stuff.


Whoo-wee, now let’s try to do some cool stuff. In your console, type:

console.log("My very first line of code on JavaScript!");

As can be observed, the duty of console.log() is print out some outputs which is being wrapped in the parentheses to the console. It can be a string, a number, a function or an object, etc…(don’t worry about that, we will talk about it soon). You also can see the word undefined when you hit enter, it’s normal, don’t be freaking out.

Not only do we have console.log(), but we also have a lot of other console methods (A JavaScript method is a property containing a function definition – we’ll talk about property and function soon). But for now, I will just list 2 other frequently used console which are console.warn and console.error().


Now in your console type something similar to this:

console.warn("Be careful");

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");

Just like console.warn(), but it is not a warn anyone. Instead, it displays an error with the red color and sometime it will appear with the “stack trace” but not this case (don’t worry much about it right now.) 😌


Now let’s do something a little cooler, say Hello World with a box appears!

alert("Hello, World!");

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.

Comment in JavaScript

What is comment and why it is essential to our code?
Actually, comment is something that we write in our code in order to make some notes of the primitive purpose is, making source code easier to human understand. Everything in comment will be ignored by compilers and interpreters. In JavaScript, comment has the syntax like those:

// 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 undefined keyword.) Nevertheless, you still are able to use /* */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 // and /* */.


From now on, you have a taste about JavaScript, what it is, console, comment…Most of you might think it’s easy to acquire. But the important point is the fundamental is something that creates matters. Hence, remember some useful information today. I will comeback soon and we will talk about something really go through JavaScript like Variable, Data Types, Array, Function…

Previous Article
Next Article

Sign up for newsletter

* indicates required