Skip to content

Instantly share code, notes, and snippets.

@conanak99
Last active March 9, 2016 00:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conanak99/ebeec83dae4e77733458 to your computer and use it in GitHub Desktop.
Save conanak99/ebeec83dae4e77733458 to your computer and use it in GitHub Desktop.
function f(x, ...y) {
// y ở đây là array, chứa ["hello", true, false]
return x * y.length;
}
f(3, "hello", true, falser) == 9;
// Cách gọi này tương tự với f(3, ["hello", true, false])
function f(x, y, z) {
return x + y + z;
}
f(...[1,2,3]) == 6;
// Cách gọi này tương tự với f(1, 2, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment