Horje
js find all max number indexes in array Code Example
how to find index of max number in js
var a = [0, 21, 22, 7];
var indexOfMaxValue = a.reduce((iMax, x, i, arr) => x > arr[iMax] ? i : iMax, 0);

document.write("indexOfMaxValue = " + indexOfMaxValue); // prints "indexOfMaxValue = 2"
find the max number in an array js
var myPersons__ = document.querySelectorAll('.avtrlnk');
var maxId__ = [];
    
	for(var x = 0; x < myPersons__.length; ++x) {
		maxId__[x] = myPersons__[x].value;
	}
	myPersons__ = parseInt(maxId__.sort()[x-1]) + 1;
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);




Javascript

Related
how to create instance of class in javascript Code Example how to create instance of class in javascript Code Example
push to an array javascript Code Example push to an array javascript Code Example
how to clear a function in javascript Code Example how to clear a function in javascript Code Example
javascript how to pass more than one selector in querySelectorall Code Example javascript how to pass more than one selector in querySelectorall Code Example
[[Prototype]] Code Example [[Prototype]] Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10