Reading Notes
this
or super
& should not be used as a methodnew.target
keywords
function (a) {
return a + 100;
}
a => a + 100;
Traditional 2
function (a, b) {
return a + b + 100;
}
(a, b) => a + b + 100;
Traditional 3
let a = 4;
let b = 2;
function (a) {
return a + b + 100;
}
let a = 4;
let b = 2;
a => a + b + 100;
Traditional 4
function (a, b) {
let chuck = 42;
return a + b + chuck;
}
Arrow Function 4
(a, b) => {
let chuck = 42;
return a + b + chuck;
}
Traditional 5
function bob (a) {
return a + 100;
}
Arrow Function 5
let bob = a => a + 100;
this
=>
called a “fat arrow”window
object when declared globally
var x = 'global';
let y = 'global';
console.log(this.x); // "global"
console.log(this.y); // undefined
window
objectconst
declaration creates a read-only reference to a variabletypeof
does not work with let
or const
const
cannot be assigned a new value after declaration, but if it is an object its properties can be updated