You can use the substring function:

let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);
Run code snippetEdit code snippet Hide Results Copy to answer Expand

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);
Run code snippetEdit code snippet Hide Results Copy to answer Expand

Neither method mutates

Answer from Jon Erickson on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ javascript-program-to-remove-first-and-last-characters-from-a-string
JavaScript- Remove Last Characters from JS String - GeeksforGeeks
July 23, 2025 - The slice() method returns a part of a string by specifying the start and end indices. To remove the last character, we slice the string from the start (index 0) to the second-to-last character.
๐ŸŒ
Stack Abuse
stackabuse.com โ€บ bytes โ€บ trim-the-last-n-characters-from-a-string-in-javascript
Trim the Last N Characters from a String in JavaScript
August 21, 2023 - For instance, you might want to remove the last character from a string only if it is a comma. ... let str = "Hello, World!,"; if (str.endsWith(",")) { str = str.substring(0, str.length - 1); } console.log(str); ... No spam ever. Unsubscribe anytime. Read our Privacy Policy. In the above code, we used the String.endsWith() method to check if the string ends with a comma.
๐ŸŒ
Bobby Hadz
bobbyhadz.com โ€บ blog โ€บ javascript-remove-last-n-characters-from-string
Remove the last N Characters from a String in JavaScript | bobbyhadz
March 1, 2024 - Copied!const str = 'bobbyhadz.com'; // โœ… Remove the last 2 characters from a string const removeLast2 = str.slice(0, -2); console.log(removeLast2); // ๐Ÿ‘‰๏ธ bobbyhadz.c // โœ… Remove the last 3 characters from a string const removeLast3 ...
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ remove last character from string in javascript
Remove the Last Character from a String in JavaScript - Scaler Topics
May 4, 2023 - Using substring() method substring() method in javascript is used to extract and return a desired part of string and by using this we can remove last character from string javascript. The substring() method takes two parameters in general, the first parameter is the starting index and the second ...
๐ŸŒ
Mastering JS
masteringjs.io โ€บ tutorials โ€บ fundamentals โ€บ remove-last-character
How to Remove the Last Character from a String in JavaScript - Mastering JS
November 12, 2021 - slice() is generally easier, however other methods available are substring() and replace(). substring() does not have negative indexing, so be sure to use str.length - 1 when removing the last character from the string. replace() takes either ...
๐ŸŒ
Favtutor
favtutor.com โ€บ articles โ€บ remove-last-character-from-string-javascript
Remove the Last Character from a String in JavaScript
January 3, 2024 - The slice() method in JavaScript is the easiest to remove the last character from a string in JavaScript. It takes two arguments โ€“ the start index and the end index. To remove the last character from the string, we take the start index as ...
Find elsewhere
๐ŸŒ
CoreUI
coreui.io โ€บ blog โ€บ how-to-remove-the-last-character-from-a-string-in-javascript
How to Remove the Last Character from a String in JavaScript ยท CoreUI
June 23, 2024 - Removing the last character from a string in JavaScript is a common task, whether youโ€™re dealing with user input or formatting strings. JavaScript provides several methods to achieve this, including slice(), substring(), and replace(). This article will cover these methods in detail, ensuring ...
๐ŸŒ
Linux Hint
linuxhint.com โ€บ remove-second-last-character-from-string-javascript
Linux Hint โ€“ Linux Hint
Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
๐ŸŒ
Medium
medium.com โ€บ @onlinemsr โ€บ how-to-remove-the-last-character-from-a-string-in-javascript-3d1c238d1669
How to Remove the Last Character from a String in JavaScript | by Raja MSR | Medium
February 15, 2024 - Have you ever wondered how to remove the last character from a string in JavaScript? If you are a web developer, you may have encountered this problem many times, especially when you are working with user input, data processing, or string manipulation. Removing the last character from a string can be tricky, as there are different methods and scenarios to consider. ... By the end of this blog post, you will have a better understanding of how to use JavaScript to remove the last character from a string, and how to apply this skill to various situations.
๐ŸŒ
SpeedySense
speedysense.com โ€บ home โ€บ javascript โ€บ remove last character from a string in javascript
Remove Last Character from a String in JavaScript - SpeedySense
April 4, 2020 - We prefer to use the slice() function to remove the last character from the string. The substr() method returns a part of the string, starting at the specified index and extracting the specified number of characters.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript-program-to-remove-last-character-from-the-string
JavaScript Program to Remove Last Character from the String | GeeksforGeeks
June 17, 2024 - These are the following ways to remove first and last characters from a String:1. Using String slice() MethodThe slice() method returns a part of a string by specifying the start and end indices.
๐ŸŒ
TecAdmin
tecadmin.net โ€บ remove-last-character-from-string-in-javascript
2 Methods to Remove Last Character from String in JavaScript โ€“ TecAdmin
April 26, 2025 - Use the slice() function to remove the last character from any string in JavaScript. This function extracts a part of any string and return as new string.
๐ŸŒ
DEV Community
dev.to โ€บ biplab3 โ€บ remove-last-character-from-javascript-string-1egd
Remove last character from javascript string - DEV Community
February 2, 2023 - The substr() is similar to the slice() function but the only difference is, it takes the second argument as the length of the string instead of the end position index. ... <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" ...
๐ŸŒ
Flexiple
flexiple.com โ€บ javascript โ€บ javascript-remove-last-character-from-string
JavaScript Remove Last Character from String - Flexiple
June 6, 2024 - The substr() method returns a portion of the string, starting at the specified index and extending for a given number of characters.
๐ŸŒ
Flavio Copes
flaviocopes.com โ€บ home โ€บ javascript โ€บ how to remove the last character of a string in javascript
How to remove the last character of a string in JavaScript
April 20, 2020 - To remove the last character from a string, use the slice() method of the string, passing 0 as the start and -1 as the end: const text = 'Hello Roger!' const editedText = text.slice(0, -1) //'Hello Roger' The two parameters are the start index ...
๐ŸŒ
Byby
byby.dev โ€บ js-remove-last-char
How to remove last character from string in JavaScript
By replacing it with an empty string, that character is removed. Please note that if the string contains newline characters or multiple Unicode code points, the regular expression approach may not behave as expected.
๐ŸŒ
Techie Delight
techiedelight.com โ€บ home โ€บ java โ€บ remove last character from a string in javascript
Remove last character from a string in JavaScript | Techie Delight
July 7, 2026 - This post will discuss how to remove the last character from a string in JavaScript using the `substring()`, `slice()`, or `substr()` method.
๐ŸŒ
Medium
medium.com โ€บ @ryan_forrester_ โ€บ javascript-remove-last-character-from-string-fc1cabdf2722
Javascript Remove Last Character From String | by ryan | Medium
September 10, 2024 - For strings with only one character, removing the last character will result in an empty string. This behavior should be acceptable for most applications, but itโ€™s important to be aware of it. ... Strings in JavaScript are immutable, meaning the original string is not modified by operations like slice() or substring().
๐ŸŒ
Coderslang
learn.coderslang.com โ€บ 0030-javascript-remove-last-character-from-a-string
JavaScript, remove last character from a string - Coderslang
February 14, 2021 - const base = 'javascript, remove last char!' const s = base.slice(0, -1); console.log(s); // javascript, remove last char ยท The function slice returns a part of the string. We pass in two values, start and end. Eventually slice returns us a substring of base between start and end. If end is a negative number, the lookup begins from the end of the string. ... As the function slice only returns us a substring and doesnโ€™t mutate the original string, we can use the function substring to get the same outcome.