This made the web look static and even worse, lifeless as it can not move nor interact with itself or perform any extra function. Fortunately, we were blessed with a man – Brendan Eich who was able to build the language of the web in ten days and change the way the web will be perceived for decades to come.
- Variables: Variables are memory locations on the computer for storing values. Think of variables as jars and sugar cubes as values stored in them. Variables are declared by the keywords “let” and “var” and assigned a value by the assignment operator “=”.
- Comments: Comments are words written to describe a code and what it does. These are written to make your code easier to read and understand by other people. A single-line comment is written by adding two trailing slashes (//) before your description and a multi-line comment is written by adding a slash and asterisk (/*) at the start of your description and an asterisk and closing slash (*/) at the end of your description which must have spanned multiple lines. Once the engine discovers these symbols before and after your descriptions, It will automatically consider It a comment and won’t try to act on them.
- Open your browser(I’m using firefox) and type ‘about:blank’ in the URL box. This is just to open a blank page.
- Once opened, switch to the console tab if not already there and you will notice two angle brackets “>>” and a blinking cursor.
- Go ahead and write – console.log(“Hello World”) and hit the enter key. You will get a result on the screen showing Hello World. “console.log()” is a function used to print out.
If you see exactly what you told the console to print out (“Hello World”), then you did it right.