Video Course

Getting Started with JavaScript for Web Development: Lesson 9 of 23


Up Next

Built-In Objects

Autoplaying in 7 seconds!


More Details on Objects

When I state that "everything is an object", that is an oversimplification. A more apt description would be:

Everything can become an object.

There are primitives (strings, numbers, and booleans) and objects (String, Number, and Boolean). For instance:

// primitives
const primitiveString = 'my string';
const primitiveNum   = 47;

// objects
const myObjString = String('my string');
const myObjNum   = Number(47);

JavaScript has the ability to convert on the fly from the primitives, to the objects, and back to the primitive when the need arises.

JavaScript will wrap the primitive in its object counterpart so that we can use the methods like .toLowerCase().

Chris Sevilleja

161 posts

Co-founder of Slapping the keyboard until something good happens.