Vue · Junior · Question 59 of 75
How do you iterate over an object's properties?
<li v-for="(value, key) in user" :key="key">{{ key }}: {{ value }}</li>- ✓Correct answer:
v-for="(value, key) in object"- the value comes first, then the key - 2Objects can't be used in
v-for - 3
v-for="key of Object.keys(obj)"is the only way
Explanation
A third alias gives the index: (value, key, index). The order follows Object.keys().