Javascript-objects Flashcards
What are objects used for?
Objects are used for grouping a set of properties and methods to create a real world model.
What are object properties?
Properties are actually variables, when inside of an object, it’s called a property, and it stores information about the object in a key value pair.
Describe object literal notation.
It has the curly brace to hold the content of the object and it’s stored in a variable. And inside of an object, key and value are separated by a colon, and each property is separated by a comma.
How do you remove a property from an object?
Use the delete keyword, follow by the object name, a dot, and the property name.
What are the two ways to get or update the value of a property?
The first one is using dot notation, object name followed by dot and property name. The second one is using square bracket, object name followed by square bracket and property name in quotes.