Sunday, July 12, 2015

There are six simple primitives in JavaScript and also nine complex primitives which are subtypes of object (one of the simple primitives).

  1. string
  2. number
  3. boolean
  4. null
  5. undefined
  6. object
    • String
    • Number
    • Boolean
    • Object
    • Function
    • Array
    • Date
    • RegExp
    • Error

 
 

So what is the difference between string and String? Answer: string actually is a string while String is just used to new up a string.

var foo = "bar";
var baz = new String("qux");

 
 

This is another insight from Kyle Simpson's book "this & OBJECT PROTOTYPES" which I am really enjoying reading!

No comments:

Post a Comment