Earlier in this chapter we came across the Object()
constructor function. It is returned when you create objects with the object literal notation and access their constructor
property. Object()
is one of the built-in constructors; there are others and in the rest of this chapter you'll see all of them.
The built-in objects can be divided into three groups:
Data wrapper objects—
Object
,Array
,Function
,Boolean
,Number
, andString
. These objects correspond to the different data types in JavaScript. Basically, there is a data wrapper object for each different value returned bytypeof
(discussed in Chapter 2) with the exception of "undefined" and "null".Utility objects—These are
Math
,Date
,RegExp
and can come in very handy.Error objects—The generic
Error
object as well as other, more specific objects that can help your program recover its working state when something unexpected happens.
Only a handful of methods of the built-in objects will be discussed in this chapter. For...