Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js find all max number indexes in array

const arr = [0,1,4,3,4];
const max = Math.max(...arr);
let res = [];
arr.forEach((item, index) => item === max ? res.push(index): null);
console.log(res);
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #find #max #number #indexes #array
ADD COMMENT
Topic
Name
9+8 =