Skip to content

Instantly share code, notes, and snippets.

@nara-l
Last active May 23, 2019 15:54
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 nara-l/b1346ef1b11d50349b61473b0db2c7a5 to your computer and use it in GitHub Desktop.
Save nara-l/b1346ef1b11d50349b61473b0db2c7a5 to your computer and use it in GitHub Desktop.
Remove some element from an object with IIFE, destructuring, and spreading
# 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