Created
August 24, 2021 12:03
-
-
Save pradeeprjth/8d6778c1330d1829983247b21fb40f3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alert( Math.max(3, 5, 1) ); // 5 | |
let arr = [3, 5, 1]; | |
alert( Math.max(arr) ); | |
let arr = [3, 5, 1]; | |
alert( Math.max(...arr) ); // 5 (spread turns array into a list of arguments) | |
// -------------------------------------------- | |
function sum(x, y, z) { | |
return x + y + z; | |
} | |
const numbers = [1, 2, 3]; | |
console.log(sum(...numbers)); | |
// expected output: 6 | |
console.log(sum.apply(null, numbers)); | |
// expected output: 6 | |
// -------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment