Javascript chop/slice/trim off last character in string -


i have string 12345.00 return 12345.0

i have looked @ trim looks trim whitespace , slice don't see how work. suggestions ?

you can use substring function:

var str = "12345.00"; str = str.substring(0, str.length - 1); 

this accepted answer, per conversations below, slice syntax clearer:

var str = "12345.00"; str = str.slice(0, -1); 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -