get last element of string in html code code example Example: javascript get last character in string var hello = "Hello World"; var lastCharOfHello=hello.slice(-1);//d