[Vuejs]-How to correctly get length of array

0👍

This is because your array has 10 undefined values therefore it does not actually have a length property, if you make sure that there is some value in each element then you will be able to get the array.
It’s a feature of JS and how the length property on the array is computed.

0👍

You can try to parse it to an array again:

// arr is an array with contains 10 items
var arr = JSON.parse(JSON.stringify(this.typeOptions));

Then, continuing with the loop…

Leave a comment