Skip to content

Instantly share code, notes, and snippets.

@dilani14
Created February 4, 2020 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dilani14/456dfbe16186cfd6bd114833b7b0b3c3 to your computer and use it in GitHub Desktop.
Save dilani14/456dfbe16186cfd6bd114833b7b0b3c3 to your computer and use it in GitHub Desktop.
assigning rest of the array
let students = ['Bob', 'John', 'Steve', 'Daniel', 'Gorge', 'Philip'];
const [first, second, third, ...other] = students;
console.log('Students except 1st, 2nd, 3rd:',other);
// output: Students except 1st, 2nd, 3rd: (3) ["Daniel", "Gorge", "Philip"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment