Advertisement
dhshin

practice_12

Jun 26th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let n = 1;
  2.  
  3. function foo() { n++; }
  4. function print() { console.log(n); }
  5.  
  6. console.log(n); // 1
  7. foo();
  8. console.log(n); // 2
  9. foo();
  10. console.log(n); // 3
  11.  
  12. function foo2(n) { n++; } // 인자 n
  13.  
  14. foo2();
  15. console.log(n); // 3
  16.  
  17.  
  18. {
  19.   let n = 10;
  20.   print(); // prints 3
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement