I'm trying to get the minimum value from an array in Vue3 but I keep getting an infinity value. Can I please get help?
Below is adding value to the 'ranks' array.
const ranks = ref([])
for (let i = 0; i < uni.value.length; i++) {
ranks.value.push(uni.value[i].rank)
}
And here is the finding min code:
const min = Math.min(...ranks.value)
console.log(min) // it returns Infinity
this is how my ranks array looks in the console: