Skip to content

Instantly share code, notes, and snippets.

@droidjahangir
Created September 15, 2021 05:38
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 droidjahangir/05aefbb6e7fbe303abf832392e2c1777 to your computer and use it in GitHub Desktop.
Save droidjahangir/05aefbb6e7fbe303abf832392e2c1777 to your computer and use it in GitHub Desktop.
const hobbiesArr = ['Sport', 'Cooking'];
// const hobby1 = hobbiesArr[0];
// const hobby2 = hobbiesArr[1];
const [hobby1, hobby2, ...remainingHobbies] = hobbiesArr; // doesn't mutate your original array
const personObj = {
firstName: 'Max',
ageNum: 30,
};
const { firstName: userName, ageNum } = personObj;
console.log(userName, ageNum);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment