Newbie here. Trying to write a function that accepts an array of strings and counts the number of strings that can be converted to a number. example: ['1', 'h','3','l','p','7'] should return 3.
function countNumbers(arr) {
for (let i of arr) {
let num = parseInt(i);
let total = 0
if (num >= 0) {
total++;
return total
}
}
}
console.log(countNumbers(['1', 'h','3','l','p','7']));