last character of string js
snippet in javascript

last character of string js

user5783


var str = "HELLO WORLD";
var res = str.charAt(str.length - 1); 

get last char javascript

user9703

var lastChar = myString[myString.length -1];

indexing string in javascript

user3319


var str = "HELLO WORLD";

var res = str.charAt(0);