-
-
Save conanak99/ebeec83dae4e77733458 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
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