O'Reilly logo
  • Michael Simon thinks this is interesting:

Although JavaScript keeps track of the data type currently stored in each variable, it doesn’t restrict you from changing types midstream. For example, suppose you declared a variable by assigning it a value:

var total = 31;


Note

Although this feature of JavaScript is convenient and powerful, it can also make it easy to make a mistake. For example, if the total variable was later used in a mathematical calculation, the result would be invalid—but JavaScript does not warn you that you’ve made this mistake.


This statement declares a vari...

Note

Needs correction. The Note is wrong, if the total variable was later used in a mathematical calculation, the result would be VALID