find highest value in array javascript

JavaScript
//For Values
var arr =[1,10,3]
var min = Math.min.apply(null, arr),
    max = Math.max.apply(null, arr);

//For Objects
var arr = [{a: 1},{a: 10},{a: 3}]
var values = arr.map(val => val.a);
var max = Math.max.apply(null, values);
console.log(max)
var arr = [1, 2, 3];
var max = arr.reduce(function(a, b) {
  return Math.max(a, b);
});let numbers = [4, 13, 27, 0, -5]; // Get max value of an array in Javascript

Math.max.apply(null, numbers); // returns 27
//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); //11const array1 = [1, 3, 2];
console.log(Math.max(...array1));const array = [10, 2, 33, 4, 5];

console.log(Math.max(...array)
)
Source

Also in JavaScript: