Well, since all your values are false, just do a !!cast to boolean:
[1,"", null, NaN, 2, undefined,4,5,6].filter(x => !!x);
Edit: Obviously the actor is not needed:
[1,"", null, NaN, 2, undefined,4,5,6].filter(x => x);
And the above code removes nulljust fine NaN, that is the problem. NaN !== NaNas Nina says in her answer.
source
share