check value of last character in string 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];
}