Ask coding questions

← Back to all posts
IH Exercises
untitledjose (0)

how to use dot notation

Commentshotnewtop
Pythonier (303)

I think it means that you need to do:

console.log(car.color);

Instead of printing the car brand.

Dot Notation

The dot notation syntax is like this: variable.element.
For example:

var d = {
    a : "ant",
    b : "bug",
    c : "cat",
    d : "dog",
}
console.log(d.c)

The d part is just accessing the dictionary, and the c is the element inside of the dictionary. The outcome of this code would be 'cat', because 'cat' corresponds to the c inside the dictionary d.

If you console.log(d.d), it would return dog to the console.

If this helps please mark my response as the answer :)

ReplTalk (636)

Hey there, please make sure your post body is at least 10 words and 100 characters. That makes it easier for our community to help you!