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:"1",
'hello world' : 'hi'
computed : 2=+2
}
console.log(m.0) - That does not work with dot notation, but works with bracket
console.log(m.hello world) - That does not work with dot notation, but works with bracket
const rank = {
a: 1,
b: 2,
[propName]: 3,
};
console.log(rank.c); // 3
4.Object.keys gives us the keys of the object, object.entries gives us the key values. Example:
const m={
first:"1",
}
obj=Object.entries(m)
console.log(obj)
keyss=Object.keys(m)
console.log(keyss)
5.Example:
const m={
0:"1"
}
values=Object.values(m)
console.log(values)
Ezgi , Mehmet Baki, Berk Akipek, Hani Muhammed.