Im trying return an int that count the last Zeros of an int, but I can´t to stop the flow of the loop when it finds something that is not zero. whats wrong?
const endZeros = (value) => {
const stringValue = `${value}`
const arrValue = stringValue.split("").reverse()
let total = 0;
arrValue.map(el => {
if (el === "0") {
total = total + 1
} else {
return // I check return false too (and true, and all! --> desesperation)
}
})
return total;
}
endZeros(100100)
Thank You, everyone ❤️