Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. function funcao() {
  2. // escopo de função
  3. var x = 1;
  4. let y = 2;
  5. const z = 3;
  6. {
  7. var x = 10; // conseguimos sobreescrever o valor
  8.  
  9. // escopo de bloco
  10. let y = 20;
  11. const z = 30;
  12. console.log(x); // 10
  13. console.log(y); // 20
  14. console.log(z); // 30
  15. }
  16. console.log(x); // 10
  17. console.log(y); // 2
  18. console.log(z); // 3
  19. }
  20.  
  21. funcao();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement