Horje
maximum element in an array javascript Code Example
max value in array javascript
// For large data, it's better to use reduce. Supose arr has a large data in this case:
const arr = [1, 5, 3, 5, 2];
const max = arr.reduce((a, b) => { return Math.max(a, b) });

// For arrays with relatively few elements you can use apply: 
const max = Math.max.apply(null, arr);

// or spread operator:
const max = Math.max(...arr);
javascript get array min and max
//get min/max value of arrays
function getArrayMax(array){
   return Math.max.apply(null, array);
}
function getArrayMin(array){
   return Math.min.apply(null, array);
}
var ages=[11, 54, 32, 92];
var maxAge=getArrayMax(ages); //92
var minAge=getArrayMin(ages); //11
how to return the max and min of an array in javascript
function minMax(arr) {
  return [Math.min(...arr), Math.max(...arr)];
}
Source: edabit.com
maximum number of an array
var arr = [1, 2, 3];
var max = Math.max(...arr);
maximum element in an array javascript
20
50
40
30
70
80
90
100




Javascript

Related
stack overflow javascript tree Code Example stack overflow javascript tree Code Example
how to prevent clickjacking in react js Code Example how to prevent clickjacking in react js Code Example
react native fade in fade out animation Code Example react native fade in fade out animation Code Example
express route parameters Code Example express route parameters Code Example
react-router-dom status code 301 Code Example react-router-dom status code 301 Code Example

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