Created
May 15, 2020 09:36
-
-
Save FurkanKozen/fafed7bf289782b078e44aeb17aed808 to your computer and use it in GitHub Desktop.
Filtering null, undefined and empty strings in JavaScript
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
var list = [1, 3, null, undefined, 5, "", "not-empty"]; | |
var filtered = list.filter(Boolean); | |
console.log(filtered); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment