javascript set value to the largest value in an array
const array1 = [1, 3, 2];
Math.max(...array1);
// expected output: 3//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//get min/max value of arrays
function getArrayMax(array){
return Math.max.apply(null, array);
Also in JavaScript:
- for of and for in javascript
- javascript save table as excel
- get youtube embed code from url
- javascript variables
- ajax vs rest
- javascript regex only letters and spaces
- javascript get black or white text base on color
- moment js print date
- js array as parameter
- angular filter ngfor
- passing livewire variable in alpine js
- post express node js input
- build angular project
- adding growl delete notifications in vanilla js
- jquery if else on click
- how react work
- javascript group by key
- redux store as number instead of string
- json parse
- js last array element
- javascript loop through object example
- value from getelementbyid
- deno vs node
- node js async delay