Advertisement
nikolayneykov92

Untitled

Jan 12th, 2020
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Hoisting
  2.  
  3. let someFunc = function() {
  4.   // var b = undefined;
  5.   // TEMPORAL DEADZONE let a, name, printName;
  6.  
  7.   // If we try to use variables (a, name ,printName) Reference Error!
  8.   let a = 5;
  9.   let name = 'Ivan';
  10.   let printName = (param) => { };
  11.  
  12.   // If we try to use b here it will be undefined
  13.   var b = 10;
  14. };
  15.  
  16. f();
  17. function f() { };
  18.  
  19. let f2 = () => { };
  20.  
  21. // Reference Type passing
  22.  
  23. let person = {name:'Ivan'};
  24. let person2 = person;
  25. person2.name = 'Gosho';
  26. console.log(person); // {name:'Gosho'};
  27. console.log(person2); // {nane:'Gosho'};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement