Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save guest271314/aaaed8ca4906ea7b348524d555d0e2b4 to your computer and use it in GitHub Desktop.
Save guest271314/aaaed8ca4906ea7b348524d555d0e2b4 to your computer and use it in GitHub Desktop.
Is it possible to destructure some properties and also assign/pass the entire object within a single assignment expression of a map callback function?
// https://stackoverflow.com/q/61298632
let o = [{firstname:0, lastname:1}, {firstname:2, lastname:3}];
const handleMapCallback = (person, _, __, {lastname, firstname} = person) => {
console.log(person, lastname, firstname);
};
o.map(handleMapCallback);
@guest271314
Copy link
Author

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