Is there a specific question you have about the algorithm? It sounds like you’re asking for someone to write it for you, in which case you’re not very likely to find someone to do that for you I’m afraid
So I am finding it difficult to convert the numbers within the string into ones.
I tried retrieving only the numbers within the strings.
This is my code:
function solution (s) {
let output = []
let sArr = s.split('')
sArr.map(element => {
if (parseInt(element)) {
console.log(element)
output.push(Number(element))
}
})
return output
}