Hello guys, I’m testing if elements in an array are truthy values or falsy ones. I have NaN inside the array being looped through but it keeps returning the NaN as a truthy value. This is the code: https://codepen.io/Tunjidev/pen/eYgJagE?editors=1111
=====https://codepen.io/Tunjidev/pen/eYgJagE?editors=1111====
I created 2 separate arrays both containing truthy and falsy values (line 1 & 2). If an element in any of the arrays is truthy, I push them to a new empty array called truthy (line 5) and if its falsy I push them to an empty array called falsy(line 4). In one of the arrays I created (line 2) it contains a NaN element but for some reason when I console.log the final output, NaN didn’t get pushed to the falsy array. What am I doing wrong pls? Thanks