Accessing properties in JavaScript is achieved by using one of two operators:
- Direct property access: obj.property
- Computed property access: obj[property]
Accessing properties in JavaScript is achieved by using one of two operators:
The syntax for directly accessing a property is a single period character, with a left-side operand that is the object you wish to access, and with a right-side operand that is the property name you wish to access:
const street = {
name: 'Marshal St.'
};
street.name; // => "Marshal St."
The right-side operand must be a valid JavaScript identifier, and as such, cannot start with a number, cannot contain whitespace, and in general, cannot contain any punctuation characters that exist elsewhere within...