There is some coding in this discussion. Feel free to write them in a REPL or in the comments below.
- How is an object different from an array?
- How does
const
work with objects? - Explain the difference between bracket syntax and dot syntax. Give an example of something that works with bracket syntax but not dot syntax. Give an example of something that works with dot syntax but not bracket syntax.
- What are computed properties? Write an example code.
- What is the difference between
Object.keys
andObject.entries
? Write example code using both of them. - How do we get only the values of an object?
Array is an ordered collection of data. Objects are unordered (though you can still look inside). Objects have key-value pairs and can hold more complex data (e.g., for a car, you can add more specific characteristics).
You can still change what is inside an object with const.
In one way, you can use quotation marks with all the characters or you can use variables to access properties.
For dot notation, you can only use dollar sign, underscore, letters, numbers, etc.
Object.keys
returns an array of keys.Object.entries
returns an array of keys and values.