Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Can primitive values be Object?

Hi there! I've heared primitive values like Number,Boolean,String couldn't be object? could they?

1 Answer

No! JavaScript has a few different Data Types;

  1. Number (1, 2, 3, 4, 5..)
  2. undefined (not yet defined)
  3. null (nothing)
  4. Boolean (true or false)
  5. String (characters within " " )
  6. Array (a set of data items seperated by comas)
  7. Objects (a series of key/value pairs of any type)

Objects can store ANY of the above data-types. Even other objects, but only arrays can store objects.

http://javascriptissexy.com/javascript-objects-in-detail/