Introduction to Objects

Get an overview of objects, their properties, and object-related methods. Learn to create objects from variables.

Objects are abstract data types used in programming. They can be used to represent real-world objects, such as people, animals or places, as well as more abstract concepts, such as bank account details, dates or file structures.

In some languages, such as Ruby, practically everything is an object. There are no primitive values, just objects. Even the number zero is an object. A large number of languages, such as Java, are class-based languages. These involve creating classes that act as a blueprint for creating all the objects in that class. For example, a Car class might specify that all Car objects will have an engine, four wheels and a choice of color.

JavaScript is not a class-based language (although we can define classes if we want to, as we’ll see later in the course). It allows us to create objects quickly and easily without the need for defining a class first.

Properties and methods

Objects can have properties and methods. Properties are information about the object, and methods are actions that the object can perform.

Get hands-on with 1200+ tech skills courses.