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?
Team members (Breakout room 1): @baraah-berra, @Rsmk-code, @sheidanouri, @houzifahabbo
0- Objects represent a particular data type that is mutable and can be used to store a collection of data (rather than just a single value). Arrays are a particular type of variable that is also mutable and can be used to store a list of values.
1- When we add const to the object we can't reassign the value of the object itself, but we can change the values of its elements
2- bracket syntax and dot syntax are two ways to access object properties in JavaScript. Bracket syntax is used when the property name is a variable or contains a space, while dot syntax is used when the property name is a valid identifier.
3-Computed properties allow you to use the values of expressions as property names of an object.
4-The keys of an object is the list of property names, but the entries of an object is the list of pairs of property names and corresponding values.
5- We can get only the object values by using
Object.values([object name])