loading...

re: Top 30 Javascript Interview Warmup Exercises VIEW POST

FULL DISCUSSION
 

Thank you for the post. 🙂

On (2) filter number,
I've just modified as following

console.log(filterNumbers([1, true, 0, "2", null, undefined, "   ", NaN, Number.POSITIVE_INFINITY, 66, "ab1", false]))
// just added true, 0, null, undefined

The output is the following.

[1, 0, "2", null, Infinity, 66]


.

It might be better to add null checking on filtering. :)

    if (isNaN(value) || isBoolean(value) || isEmptyString(value) || value === null) {

-> result [1, 0, "2", Infinity, 66]

I continue reading 3)... 🍣

Thank you.

 
Code of Conduct Report abuse