Skip to content

Instantly share code, notes, and snippets.

@tranduclinh2067
Created January 10, 2019 14:20
Show Gist options
  • Save tranduclinh2067/27c50644e662cb2724177b383afa787b to your computer and use it in GitHub Desktop.
Save tranduclinh2067/27c50644e662cb2724177b383afa787b to your computer and use it in GitHub Desktop.
Rest parameters
var abc = ['a','b','c'], def = ['d','e','f'];
var sum = [...abc, ...def];
console.log(sum);
//Result: ["a", "b", "c", "d", "e", "f"]
@tranduclinh2067
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment