Created
April 19, 2020 15:35
-
-
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?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@awvalenti re https://stackoverflow.com/q/61467793 see above.