Test array: [2, 3, 6, 7, 10, 1]; . Expected value on function return: 4 .
I did it like that but it's returning the value to me. I need the highest value index :
function highestNumber(array) {
let biggerNumber = 0;
for (let index = 0; index < array.length; index += 1) {
if (array[index] > biggerNumber) {
biggerNumber = array[index]
}
}
return biggerNumber;
}
highestNumber([2, 3, 6, 7, 10, 1]);