Question · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects
Object Basics - Accessing Properties
What are the two ways to access object properties in JavaScript?
Answer options
- Dot notation (obj.key) and bracket notation (obj['key'])
- Only dot notation can be used
- Colon notation (obj:key) and bracket notation (obj[key])
- Arrow notation (obj->key) and dot notation (obj.key)
Show the answer
Correct answer:
- Dot notation (obj.key) and bracket notation (obj['key'])