Guest User

Untitled

a guest
Apr 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. //Old way of using var
  2.  
  3. var myAge = 27; //this can change
  4. var myGender = "Male"; //this cannot change
  5.  
  6. //To express the above in the new way
  7. let myAge = 27; //I use let because my age will always change
  8.  
  9. const myGender = "Male";
  10.  
  11. /**
  12. * Below will give a Type Error:
  13. * because a predefined const should not change
  14. */
  15. myGender = "Female"; //Error
Add Comment
Please, Sign In to add comment