How to get the index of the min value in an array in Node.js

1 Answer

0 votes
const arr = [8, 11, 12, 7, 18, 10, 4, 6, 9, 5];

const index = arr.indexOf(Math.min(...arr));

console.log(index);




/*
run:
  
6
  
*/

 



answered Jul 8, 2022 by avibootz

Related questions

1 answer 122 views
1 answer 178 views
1 answer 149 views
1 answer 164 views
1 answer 140 views
2 answers 175 views
...