Those from the Browser Object Model
Those from the Document Object Model
Custom objects from the developer
data types, discussed in Chapter 2:
String for strings,
Boolean for booleans, and, of course,
Number for numbers. Each of these objects
encapsulates our basic types; they manage conversion tasks, as well as
provide additional functionality.
There are also several special-purpose objects, such as
RegExp. That last object provides
powerful, though extremely cryptic, patterning capabilities that enable
you to add very precise string matching to applications.
arrays, though they may not look as such when you work with them. All of
Object is covered in Chapter 11, which goes
extensibility is a bit unusual. Though current versions of JS are not
constructor and the ability to create instances of objects through the
use of the
All but one of the built-in objects have unique and useful methods and properties associated with the object type, some of which are accessible with object instances. Others are static, which means theyâre only accessible directly on the shared object.
The one object that doesnât have any unique properties or
methods is the
object. The only methods and properties it has are those associated with
Object itself. Iâll use it to
demonstrate creating new instances of an object, and then move on to
covering the other more complex objects.
To create a new instance of the
Boolean object, use the
new keyword and the following syntax:
var holdAnswer = new Boolean(true);
Boolean is instantiated,
you can access the primitive value it encapsulates (encloses) using
if (holdAnwer.toValue) ...
You can also access it directly, as if it were a primitive data type:
if (holdAnswer) ...
Boolean object lacks new
and exciting functionality, the other objects compensate for it.