Vue · Junior · Question 23 of 75

How do you get the index in v-for?

Explanation

For objects the syntax is (value, key, index) in object. v-for can also iterate a range: v-for="n in 10" renders 1 to 10.

Further reading

Problem with a question

Vue · Junior · question 23

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz