...

/

Discussion: Truth or Fiction?

Discussion: Truth or Fiction?

Execute the code to understand the output and gain insights into boolean conversion and truthy vs. falsy values.

Verifying the output

Now, it’s time to execute the code and observe the output.

Press + to interact
const arr = [1, 8, NaN, 15, ""];
const newArr = arr.filter(function(item) {
return !!item
});
console.log(newArr);

NOT NOT

The code !! in JavaScript can be used as a quick way of converting a ...