### Javascript Syntax

#### Statements

Statements are instructions to be executed by the web browser. Every statement should be finished with a semicolon ( ; ). The Javascript code is composed of multiple statements that will be executed in sequential order, from top to bottom.

        console.log('statement 1');
        console.log('statement 2');

Each web browser has its own Javascript interpreter that is responsible for executing the statements we write. They are also called Javascript engines. See the table below for the interpreters of the most popular web browsers:

Browser | Interpreter
--- | ---
Google Chrome | V8
Mozilla Firefox | Gecko, SpiderMonkey e Rhino.
Safari | Nitro
Microsoft Edge | Chakra
Opera | Carakan

#### Comments

Like every other programming language, we can use comments in Javascript to indicate lines of code that should be ignored by the interpreter. The double forward slashes ( // ) are used for one-line comments and multi-line comments can be done just like in CSS, starting with ( /* ) and ending with ( */ ).

        // This line of code is commented and will be ignored by the web browser

        console.log('This statement will be executed');

        // console.log('This statement has been commented and will be ignored');

        /*
            None of these lines
            will be executed
            by the interpreter
            console.log('This statement will be ignored');
        */

The most popular text editors have shortcuts to toggle comments. In Visual Studio Code you can use SHIFT + ALT + A to comment or uncomment lines of code. You can also find those option in the menu Edit > Toggle Line Comment and Toggle Block Comment.

#### Case Sensitive

Javascript is a case sensitive language, which means that:

        // This:

        console.log('something');

        // Is not the same as this:

        Console.log('something');

The last example will result in an error because there's no object called "Console" with a capital "C". Because of this, we should be very careful with the names of objects, properties and methods so we don't make mistakes that will generate errors in our code.

### Contents