Skip to content

Instantly share code, notes, and snippets.

@suhailgupta03
Created August 16, 2023 16:17
Show Gist options
  • Save suhailgupta03/a4ac188a30d5235154682956b3ef6524 to your computer and use it in GitHub Desktop.
Save suhailgupta03/a4ac188a30d5235154682956b3ef6524 to your computer and use it in GitHub Desktop.
let arr = [1,2,3,4];
// console.log(arr[0]); // 1
// console.log(arr[1]); // 2
// console.log(arr[2]); // 3
const [f, s] = arr;
// the above concept is called
// destructuring because we are
// destructuring the array into
// two variables f and s
console.log(f); // 1
console.log(s); // 2
@suhailgupta03
Copy link
Author

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