Created
October 2, 2018 14:42
-
-
Save k4Shinigami/d61b3bd0ec449e8b54658bf466dd44fb to your computer and use it in GitHub Desktop.
Spread operator with function and param names
This file contains hidden or 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
function add ([x, y, z]) { | |
return x + y + z; | |
} | |
var arr = [1,2,3]; | |
console.log(add(arr)); |
OR
function add (x, y, z) {
return x + y + z;
}
var arr = [1,2,3];
console.log(add.apply(null, arr));
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OR