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 227 views
1 answer 282 views
1 answer 241 views
1 answer 275 views
1 answer 230 views
2 answers 304 views
...