Statements
Statements are syntax constructs and commands that perform actions.
/**
* Semicolon can be omitted, but not recommended
* A semicolon is not assume before square brackets
*/
console.log("Hello"); // Hello
console.log("World"); // World
console.log(1 + // 6
2 + 3
);
try {
console.log("abc") // Look Here
[1, 2].forEach(console.log);
} catch (err) {
console.log(err.name); // TypeError
}
Comments
In most editors, you can comment out by pressing the Ctrl + /
/**
* One-line comments start with two forward slash characters //
* Multiline comments start with a forward slash and an asterisk /*
*/
console.log('Hello'); // one line comment
Last update: 496 days ago