dot operator javascript

Solutions on MaxInterview for dot operator javascript by the best coders in the world

showing results for - "dot operator javascript"
Monica
29 Jan 2020
1Lets first look at Dot notation. Consider this example below:
2let obj = {
3  cat: 'meow',
4  dog: 'woof'
5};
6let sound = obj.cat;
7console.log(sound);
8// meow
9I want to bring your attention to the fifth line where we’re using dot notation: let sound = obj.cat;. This is an example of dot notation. You can access properties on an object by specifying the name of the object, followed by a dot (period) followed by the property name. This is the syntax: objectName.propertyName;.
10When working with dot notation, property identifies can only be alphanumeric (and _ and $). Properties can’t start with a number.