Is it okay to use Math.min.apply when the length of the Array is 10?
getAllIndexes(arr, val) {
var indexes = [], i = -1;
while ((i = arr.indexOf(val, i+1)) != -1){
indexes.push(i);
}
return indexes;
}
arrayMinIndex(array) {
return this.getAllIndexes(array, Math.min.apply(Math,array));
}
https://i.sstatic.net/917Yz.png
However, when the Array's length is larger, for example 100, the value becomes NaN.
https://i.sstatic.net/Ibzlf.png
UPDATE!!!!
If I change the index names from 00,01,02,03 ... 99 to 0,1,2,3,4 ... 99, it works fine.
https://i.sstatic.net/vQx7H.png
In this scenario, I dynamically created the Array where the index name is a String. https://i.sstatic.net/BaPUJ.png
So, why does the index name cause a problem with Math.min?