JavaScript chop/slice/trim off last character in string
//You can use the substring function:
let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);
//This is the accepted answer, but as per the conversations below, the slice syntax is much clearer:
let str = "12345.00";
str = str.slice(0, -1);
console.log(str);
Also in JavaScript:
- salvar no localStorage react
- javascript http get request
- jquery add attribute
- jquery selected label option
- cdnjs smeantic ui
- random number js
- cnpj validator javascript
- js query string
- java.lang.IllegalArgumentException: Can only download HTTP/HTTPS
- get element by id in Jquery
- mongoose database pooling
- javascript note
- line line intersection
- aos js cdn
- convert table to excel reactjs
- how create an index mongodb
- javascript remove the current tr with click
- string methods javascript
- js substr
- get name jquery
- app script append two list
- jquery add input placeholder
- bootstrap show modal on page load
- insertion sort javascript