how to get last string in javascript

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

Also in JavaScript: