Last active
May 23, 2019 15:54
-
-
Save nara-l/b1346ef1b11d50349b61473b0db2c7a5 to your computer and use it in GitHub Desktop.
Remove some element from an object with IIFE, destructuring, and spreading
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
# IIFE, destructuring, and spreading | |
# given and object of colors | |
const colors = {red: '#ff0000',green: '#00ff00', blue: '#0000ff' } | |
# We can remove blue without using a filter by doing this | |
((blue, ...rest) => rest)(colors) | |
# results | |
{red: "#ff0000", green: "#00ff00"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment