#4 Primitives - Lessons Learned While Reading "Effective Javascript"

Javascript has five primitives available:

  • Booleans
  • Null
  • Numbers
  • Strings
  • Undefined

 

You can also implicitely coerce Object properties/methods from primitives:

>"WHISPER".toLowerCase();
"whisper"

Keep in mind that because of this feature, it's quite easy to make the mistake of setting properties on primitive variables. JS will silently accept it - discarding your properties immediatly.