I'm doing a function that extracts all the numbers from one array and stores them in another, but when I get to 0 it does not recognize it as a number, here my code:
function filter_list(l) {
return l.filter(function(e){
if(typeof e == "number") return e;
});
}
Array passed as parameter: [1, 'a', 'b', 0,15] Array returned: [1,15], but it should be: [1, 0, 15]
Thanks and best regards.