Objectively Flashcards
1
Q
Syntax for accessing object properties
2 ways. Why?
A
- Dot notation
object. property - Bracket notation
object[“property”]
obj[ “a” ] is the same as obj.a
Use brackets for vars assigned to properties var propname = getPropName(); var result = obj[ propname ]; //
2
Q
Object property names are what type?
A
String (even numeric values)
3
Q
Definition of object?
A
Collection of properties, defined as name/value pairs