Skip to content

Instantly share code, notes, and snippets.

@dilani14
Created February 4, 2020 07:30
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/40805dd6b7285f5f3cc6162881ee1946 to your computer and use it in GitHub Desktop.
Save dilani14/40805dd6b7285f5f3cc6162881ee1946 to your computer and use it in GitHub Desktop.
nested destructuring array
let students = ['Bob', 'John', ['Steve', 'Daniel'], 'Philip'];
const [first, second, [third, fourth]] = students;
console.log(`Thrid and Fourth are : ${third} and ${fourth}`);
//output: Thrid and Fourth are : Steve and Daniel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment