filterNums(list)/*
Takes an array list as input and returns a new array
with only numbers and drops everything else.
*/filterNums([5,10,'hello','world']);// [5, 10]filterNums(['get',1,'only',2,'nums']);// [1, 2]
filterNums(list){// Initialize a an empty arraylet numArr =[];// Push all numbers to the new array
list.forEach(element=>{if(Number.isFinite(element)){
numArr.push(element);};});// Return the new arrayreturn numArr;}