Javascript 4.5 Objects Flashcards
Define “Objects”
An object is a collection of data and/or functionality. These usually consist of several variables and functions. ( Which are called properties and methods)
How do you access Object literals
dot notation and using square brackets
How do you set a value to an object
varName.name = ‘new value’;
In a ( for…. in ) loop how do we access a properties value
Using bracket notation preceded by the name of the object. The name within the bracket will be the var name declared within the for….in loop
What method returns an Array containing the property names or keys?
Object.keys( ); method
What method returns an Array containing the property values?
Object.values( ); method
How can we combine two objects with a special operator?
The spread operator ( … )