Last active
June 3, 2020 14:33
-
-
Save bobdobbalina/f4eba4a88559090d0745d378782f1172 to your computer and use it in GitHub Desktop.
Javascript: Removing Falsy Values From Arrays
This file contains hidden or 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
myArray.filter(Boolean); | |
// OR, IF YOU WANT TO MAKE MODIFICATIONS ON THE FLY | |
myArray | |
.map(item => { | |
// Do your changes and return the new item | |
}) | |
.filter(Boolean); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment