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?
0: 🟢Array vs Object:
arrays:
object:
1: 🟢const:
one way of restricting objects, in which a way that reference is immutable but content(key or value) is mutable.
2: 🟢Dot vs Bracket Notation:
1. dot:
obj.prop, obj.prop_1, obj.prop$
✅obj.1prop
❎obj.prop name
❎2. bracket:
ex:
obj["prop_name"], obj["prop name"], obj["1 prop"]
✅ex:
3: 🟢Computed Properties:
This feature allows for dynamic names that calculated at runtime.
For example:
For example:
4: 🟢Object.keys vs Object.entries:
Object.keys():
Object.entries():
5: 🟢How do we get only the values of an object? Object.values().
References: