Light Mode
Dark Mode
JS mission End Zeroes

Hello, I can't get my solution accepted and I don't understand what is wrong.

My code:

function endZeros(a: number): number {

let b = String(a);
let out:number = 0;
for (let i = b.length - 1; i >= 0; i--)
{
    if (b[i] != 0) { return out }
    out += 1;

}

return out;

}

When checking solution I get error:

9,13: This condition will always return 'true' since the types 'string' and 'number' have no overlap.

Created: Oct. 6, 2022, 7:48 p.m.
Updated: Oct. 10, 2022, 5:27 p.m.
0
5
User avatar
gimbo123