javascript-objects Flashcards
What are objects used for?
Objects are a standalone entity with a property and type. They group together functions and variables. They allow for storing multiple data types which is something that variables can’t do. You can have two variables with the same name as long as they are in different scopes
What are object properties?
Object properties are variables that live in an object. They are what give us info about the object.
Describe object literal notation.
It’s the most common/easiest way to define an object. The object is in a set of curly braces. That object is stored in a variable. Separate each key from its value with a colon. Separate properties and methods by commas.
How do you remove a property from an object?
by using the delete operator
delete cat.type
What are the two ways to get or update the value of a property?
bracket notation vs dot notation
pet[‘type’} vs pet.type