Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Arrow Functions
- console.log(identity); //Undefined - Function is not hoisted
- var identity = x => x ;
- console.log(identity); //Function or x => x
- //console.log(new identity()); //Error - not a constructor
- //Context Example
- function test2() {
- console.log(this); //test2 - this refers to the object
- var test3 = x => console.log(this);
- function test4() {
- console.log(this);
- }
- test3(); //Refers to test2
- var b = new test4(); //Refers to test4
- }
- var a = new test2();
Add Comment
Please, Sign In to add comment