The JavaScript Object Object

The JavaScript Object global object creates an object wrapper for any given value:

var obj = new Object([value])

If the value is null or undefined, the Object constructor creates an empty object. Otherwise, it will create an object of a type that corresponds to the given value:

var number_object = new Object(123); // equivalent to number_object = new Number(123);
var array_object = new Object([1, 2, 3]); // equivalent to array_object = new Array([1, 2, 3]);

Object Properties

constructor
Returns a reference to the function that created the Object object
prototype
Allows the addition of properties and methods to all objects

Object Methods

hasOwnProperty(property)
Returns true if the object has the specified property, or false otherwise
isPrototypeOf(object)
Returns true if the object is in the specified object's prototype chain, or false otherwise
propertyIsEnumerable(property)
Indicates whether the specified property is enumerable (i.e. can be enumerated in a for...in loop)
toLocaleString()
Returns a locale-aware string representation of the Object object
toString()
Returns a string representation of the Object object
valueOf()
Returns the primitive value of the object

If you see a typo, want to make a suggestion or have anything in particular you'd like to know more about, please drop us an e-mail at hello at diveintojavascript dot com.

Copyright © 2010-2013 Dive Into JavaScript