Last active
September 26, 2021 17:29
-
-
Save whitelizard/c9a902df62e0c61bc8300cf66bec693c to your computer and use it in GitHub Desktop.
Destructuring in multiple steps
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
const func = (params = {}, data = {}) => { | |
const { | |
fallbackMessage: msg = 'Unknown', | |
offset = 4, | |
pos = {}, | |
...options | |
} = params; | |
const { x = 0, y = 0 } = pos; | |
const { title = '', items = [] } = data; | |
const [head, ...tail] = items; | |
// some nice logic | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment