how to get last string in javascript

JavaScript
'abc'.slice(-2);'abc'.slice(-1); // c
Source

Also in JavaScript: