Javascript
/
Fundamentals
- 1 Fundamentals 11
-
Hello World S
-
Code structure S
-
Use strict S
-
Variables S
-
Data types S
-
Type conversions S
-
Maths S
-
Comparitions S
-
Conditional S
-
Loops S
-
Functions S
- 2 Testing 2
-
Mocha S
-
Nested describe S
- 3 Objects 4
-
Basics S
-
Reference S
-
Methods S
-
Constructor S
- 4 Types 5
-
Primitives S
-
Numbers S
-
Strings S
-
Arrays S
-
Json S
- 5 Classes 3
-
Constructor S
-
Binding S
-
Inheritance S
S
R
Q
Javascript Fundamentals Code Structure
Semicolon between statements, recommended Comments, one lone or multiline console.log("Hello"); console.log("World"); // comment
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
➥ Questions