Guest User

Untitled

a guest
Nov 18th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. //Arrow Functions
  2. console.log(identity); //Undefined - Function is not hoisted
  3. var identity = x => x ;
  4. console.log(identity); //Function or x => x
  5. //console.log(new identity()); //Error - not a constructor
  6.  
  7. //Context Example
  8. function test2() {
  9. console.log(this); //test2 - this refers to the object
  10. var test3 = x => console.log(this);
  11. function test4() {
  12. console.log(this);
  13. }
  14. test3(); //Refers to test2
  15. var b = new test4(); //Refers to test4
  16. }
  17.  
  18. var a = new test2();
Add Comment
Please, Sign In to add comment