Created
July 30, 2020 20:49
-
-
Save drhisham-code/b186db5ecb6671151880419babd9ae2a to your computer and use it in GitHub Desktop.
filter js array to only truthy values
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
| let truthyAndFalsy = [4, 56, 78, 99, 101, 150, 299, 300,"",undefined]; | |
| let onlyTruthy =truthyAndFalsy.filter(number => Boolean(number)); | |
| console.log(onlyTruthy) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment