Consider this scenario: I have a string "asdf123d6lkj006m90" and I want to extract the values [123, 6, 0, 0, 6, 90]. My attempt so far is as follows:
let str = "asdf123d6lkj006m90"
let func = function(inputString){
let outputArray = []
let currentNumber = ""
for(let element of inputString){
if(Number(element)||element == 0){
outputArray.push(Number(element))
}
}
return(outputArray)
}
console.log(func(str))
However, this code generates the result [1, 2, 3, 6, 0, 0, 6, 9, 0]. How can I modify it to get the correct numbers?