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