Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1.  
  2. // ES6 const and block scoping
  3.  
  4. const myFavouritePie = 'Apple';
  5. console.log(myFavouritePie) // Apple
  6.  
  7. {
  8. // having trouble to think of any pie except apple
  9. myFavouritePie = 'Chicken'; // Uncaught TypeError: Identifier 'cake' has already been declared
  10. }
  11.  
  12. // Gotcha
  13. const myFridgeContents = {
  14. milk: 1,
  15. applePie: 23
  16. };
  17.  
  18. myFridgeContents.applePie = 22; // this is valid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement