JavaScript Basics: Work With and Create Custom Objects


show more Get comfortable working with objects in the DOM (Document Object Model) and creating custom objects with their own properties and functions in this JavaScript tutorial. show less
please wait ...

Working with objects

So JavaScript does have this idea of objects, although if you're used to formal object-oriented programming languages, you'll find it very basic. It has a few very straightforward ideas about what makes an object, and we've already been doing it. If we make an array, that's an object. If we make a date, that's an object. These objects are self-contained pieces. If I have an array, I can use the dot operator to say I'm interested in its .length. In this case it would be 5. If I have a date, I can call methods of it. Again, these are functions that belong to an object.

So I can say getTime or getFullYear, and as soon as we start touching our web pages, we'll have other objects that represent all the different pieces of the page, what's referred to as the DOM or Document Object Model, and we can even make our own. So we're going to get comfortable working with objects. And at its core, the idea of an object is really simple. It's just a container that gath...

Working with objects
Video duration: 7m 58s 5h 31m Beginner

Viewers:

Get comfortable working with objects in the DOM (Document Object Model) and creating custom objects with their own properties and functions in this JavaScript tutorial.

Subjects:
Developer Web
Software:
JavaScript
Author:
please wait ...