Javascript
/
Fundamentals
- 1 Fundamentals 11
-
Hello World
-
Code structure
-
Use strict
-
Variables
-
Data types
-
Type conversions
-
Maths
-
Comparitions
-
Conditional
-
Loops
-
Functions
- 2 Testing 2
-
Mocha
-
Nested describe
- 3 Objects 4
-
Basics
-
Reference
-
Methods
-
Constructor
- 4 Types 5
-
Primitives
-
Numbers
-
Strings
-
Arrays
-
Json
- 5 Classes 3
-
Constructor
-
Binding
-
Inheritance
/
Code structure
➟
➟
Last update: 11-01-2022
Statements
Statements are syntax constructs and commands that perform actions.
/**
* Between statements the semicolon can be omitted, but ...
* it is recommended to put semicolons every time.
* Javascript does not assume a semicolon before square brackets.
*/
console.log("Hello");
console.log("World");
// Hello
// World
console.log(1 +
2 +
3
); // 6
console.log("There will be an error") // Look here - no semicolon
// There will be an error
[1, 2].forEach(console.log);
// Uncaught TypeError: Cannot read property
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 /*
*/
// one line comment
console.log('Hello');
/**
* Multi line comment
*/
console.log('World');
➥ Questions github Fundamentals