Friday, March 4, 2016


In this challenge we have to remove all falsy values from an array.

Falsy values in JavaScript are:-

 false, null, 0, "", undefined, and NaN.

For this challenge I went through the clues that are given in the form of clickable links above, again leading to MDN JavaScript documentation.

Then on with little bit of tweaking I was able to implement the under-mentioned solution for the challenge.

So, here is my solution.

                function bouncer(arr) {
             function Boolean(value){
                 var i = 0;
                 arr1 = [NaN, 0, false, null, undefined];
                 if (arr1[i] === value){

                 return value;
             return arr.filter(Boolean);

No comments:

Post a Comment