how to call the last character of a string in javascript code example
Example 1: javascript get last character in string
var hello = "Hello World";
var lastCharOfHello=hello.slice(-1);//d
Example 2: get last word in string js
function test(words) {
var n = words.split(" ");
return n[n.length - 1];
}