Check out example codes for "javascript remove last character from string". It will help you in understanding the concepts better.

Code Example 1

var str = 'mystring';

// the character 'g' will be removed
str = str.slice(0, -1);

Code Example 2

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

Code Example 3

let str = 'asss';

str = str.split(''); // (4) ["a", "s", "s", "s"]
str.pop(); // (3) ["a", "s", "s"]
str = str.join(''); // "ass"

Code Example 4

const text = 'abcdef'
const editedText = text.slice(0, -1) //'abcde'

Code Example 5

let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);

Code Example 6

var str = "Hello";
var newString = str.substring(0, str.length - 1); //newString = Hell

Code Example 7

let str = "12345.00";
str = str.slice(0, -1); 
console.log(str);

Code Example 8

assss

Code Example 9

let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);

Code Example 10

let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);

Learn ReactJs, React Native from akashmittal.com