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?
Gulet, Sakarie, Jimaa
0. Array: We can store different data type in one variable while objects are used to store collections of key-value pairs with no specific order and can store values of different data types.
2. When using "Const" with Object, we cannot reassign the values of the object later, but we can reassign the properties of the object.
3. Dot notation is the more common syntax, while bracket notation is used in certain cases when the property name is not a valid identifier or is dynamic.
4. Both methods in are used to extract information about the properties of an object. The difference in is type of information they provide
5. We Can use Object.values().