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 220 views
1 answer 272 views
1 answer 234 views
1 answer 265 views
1 answer 224 views
2 answers 299 views
...