for char 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: js for each character in string
for (var i = 0; i < str.length; i++) {
alert(str.charAt(i));
}