In this kata you will create a function that takes a list of non-negative integers and strings and returns a new list with the strings filtered out.
My code:
function filter_list(l) {
let arrayInt = [];
for (let i = 0; i < l.length; i++) {
if (typeof l[i] === 'number') {
arrayInt.push(l[i]);
}
}
return arrayInt;
}
function filter_list(l) {
return l.filter(function(v) {return typeof v == 'number'})
}
New things I learned today: