Object properties in JavaScript

There is an alternative way to access the elements of an object. In this method, we put a dot after the object name and then write the name of the key. In this case, the key is called a property of the object. Let's see how it's done. Let's have the following object:

let obj = {a: 1, b: 2, c: 3};

Display the value of its property:

console.log(obj.a); // shows 1

Create the object date with the keys 'year', 'month' and 'day' and values corresponding to the current day. Display the created date on the screen in the format year-month-day.