Code check - am I going in the right direction?

I’m doing one of Kata challenges on Code Wars and I’m a beginner at JS but I really really want to solve this one…
can someone please let me know if for the below exercise, my solution (which doesn’t work) is going in the right direction?

Aim: get rid of zeros only at the end of a number:
1450 - 145
1500 - 15
10500 - 105

My solution - am I going in the right direction?

function zero(n) {
for(i = 0; i > n.length; i++) {
if(n.endsWith == 0) {
} return n;

Are you being given a number? In that case splice() and endsWith() wouldn’t work, as splice() is an array method and endsWith() is a string method
Same for length, that is a string and array property

You can do that in a mathematical way, or you can convert your input to an other type of data