Answers for "javascript trim after last string"

3

javascript chop slice trim off last character in string

let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);
Posted by: Guest on December-13-2019
-1

javascript remove last word from string

var str = "I want to remove the last word.";
var lastIndex = str.lastIndexOf(" ");

str = str.substring(0, lastIndex);
Posted by: Guest on December-28-2020

Code answers related to "javascript trim after last string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language