how to get the last character in a string javascript code example
Example 1: js remove last character from string
let str = "Hello Worlds";
str = str.slice(0, -1);
Example 2: javascript get last character in string
var hello = "Hello World";
var lastCharOfHello=hello.slice(-1);
Example 3: javascript remove last character from string
var str = "Hello";
var newString = str.substring(0, str.length - 1);
Example 4: get last char javascript
var lastChar = myString[myString.length -1];
Example 5: javascript remove last character from a string
let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);
Example 6: get last letter of string javascript
var name = 'Shareek';
var new_str = name.substr(-5);