Skip to content

Instantly share code, notes, and snippets.

@tranduclinh2067
Created January 12, 2019 04:22
Show Gist options
  • Save tranduclinh2067/eb0ecaad42d1eff02263199a93012e43 to your computer and use it in GitHub Desktop.
Save tranduclinh2067/eb0ecaad42d1eff02263199a93012e43 to your computer and use it in GitHub Desktop.
Bạn muốn lấy các phần tử còn lại có trong mảng?
const [a, b, ...arr] = [1, 2, 3, 4, 5, 7];
console.log(a, b); // 1, 2
console.log(arr); // [3, 4, 5, 7]
// => a = [0], tương tự vậy b[1], nhưng ...arr sẽ lấy hết các phần còn lại bao gồm arr[n++] tiếp theo sau đó.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment