Objectively Flashcards

1
Q

Syntax for accessing object properties

2 ways. Why?

A
  1. Dot notation
    object. property
  2. 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 ];  //
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Object property names are what type?

A

String (even numeric values)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Definition of object?

A

Collection of properties, defined as name/value pairs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly