Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function maxElement(arr) {
let max = Math.max.apply(null, arr)
return max;
}
let result = maxElement([7, 5, 33, 3]);
console.log(result)
function maxElement(arr) {
// Using Rest parameter gives us an unpacked version of the array.
let max = Math.max(...arr)
return max;
}
let result = maxElement([7, 5, 33, 3]);
console.log(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment