Last active
August 29, 2015 14:07
-
-
Save colintoh/6a5dc21b1681c83523a6 to your computer and use it in GitHub Desktop.
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
var register = function(name,age,gender){ | |
console.log([name,age,gender].join(" ")); | |
} | |
var arr = ["Mary","22","F"]; | |
//Without Spread Operator | |
register.apply(null,arr); // "Mary 22 F" | |
//With Spread Operator | |
register(...arr); // "Mary 22 F" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, wouldn’t
console.log([name,age,gender].join(" "));
produce the same output that
console.log(name,age,gender);
?