Code highlights logo



Accessing Properties

One way to access properties of an object is by using the dot notation. The dot notation is straightforward and concise, making it widely used in JavaScript.

Here is an example:

1const person = {
2 name: 'John Doe',
3 age: 30,
4 occupation: 'Web Developer'
7console.log(; // Output: John Doe
8console.log(person.age); // Output: 30
9console.log(person.occupation); // Output: Web Developer

In the example above, we have an object called person with three properties: name, age, and occupation. We can access these properties using dot notation by appending the property name to the object name.



Print the value of the property name from the person object using dot notation.

Sign up to start coding

Already have an account?

Sign In

Course content