We're a place where coders share, stay up-to-date and grow their careers.
You can also do [1, 2, 3, 4, null, 5, undefined].filter(Boolean) to remove falsey values.
[1, 2, 3, 4, null, 5, undefined].filter(Boolean)
You can also do
[1, 2, 3, 4, null, 5, undefined].filter(Boolean)
to remove falsey values.