Created
January 10, 2019 14:20
-
-
Save tranduclinh2067/27c50644e662cb2724177b383afa787b to your computer and use it in GitHub Desktop.
Rest parameters
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
var abc = ['a','b','c'], def = ['d','e','f']; | |
var sum = [...abc, ...def]; | |
console.log(sum); | |
//Result: ["a", "b", "c", "d", "e", "f"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trong ES6 thì việc sử dụng RP (Rest Parameters) để truyền tham số vào function rất thoải mái, nhưng truyền với số lượng không xác định thì việc nâng cấp và bảo trì là rất khó. Chú ý và cân nhắc khi sử dụng chúng.