I'm new in Javascript, I want to Create a function that takes an array of non-negative integers and strings and return a new array without the strings.
Examples filterArray([1, 2, "aasf", "1", "123", 123]) ➞ [1, 2, 123]
I've tried this code :
function filterArray(arr) {
    var j=0;
    var numArr;
    for (let i=0;i<length.arr;i++)
    {
        if (typeof arr[i] ==="number") 
        {
            numArr[j]=arr[i];
            j++;
        }       
    }
    return numArr
}
console.log(filterArray([1, 2, "aasf", "1", "123", 123]));but i didn't arrive to run my code, can someone helps me ?
 
     
     
     
     
     
     
    