09 - Objects
JavaScript Objects
Introduction to Objects
JavaScript uses a data structure called Object that helps to organize data together. There are a couple of ways of creating an object in JavaScript, one way of doing it would be by using the curly brackets.
var colors = {};
These curly brackets are called Object Initializer. They create an empty object. We hold a reference to the object by using the variable colors.
Now, we can add properties to this colors object by providing the desired property names after a dot. This is called dot notation. We will also assign values to these newly created properties.
Get hands-on with 1300+ tech skills courses.