console.log(Number.MAX_SAFE_INTEGER);
// expected output: 9007199254740991
// Number.MAX_VALUE returns the largest number possible in JavaScript.
console.log(Number.MAX_VALUE)
// output 1.7976931348623157e+308.
//Returns number with highest value.
var x = Math.max(-5, 12, 27);
console.log(x)//27
<!DOCTYPE html>
<html>
<body>
<p>In this example we can able to check the index value of largest array value</p>
<script>
var marks = [30, 100, 50, 90, 40];
function IndexValueOfALargestArrayValue(array){
var startingValue = 1;
var maximumValue = 0;
for(startingValue; startingValue < array.length; startingValue++){
if(array[maximumValue] < array[startingValue]){
maximumValue = startingValue;
}
}
return maximumValue;
}
document.write("The largest Number Index value is:" +IndexValueOfALargestArrayValue(marks));
</script>
</body>
</html>
arr.indexOf(Math.max(...arr))