Tuesday, February 4, 2014

Javascript Types

We can categorize Javascript data types in different ways.

Category I

  • Primitive Types 
Numbers, strings, booleans, null, undefined
  • Object Types
Everything other than the above, including regular object and special kinds of object (Array, Function, Date, RegExp, Error)

Category II

  • Have Methods
Objects, numbers, strings and boolean (numbers, strings and booleans behave as if they had methods)
  • Don't Have Methods
null and undefined

Category III

  • Immutable 
Numbers, boolean, null, undefined, strings (different from Ruby, in which string is mutable)
  • Mutable
Objects and arrays

No comments:

Post a Comment