javascript get last element of a str code example Example: how to get last string in javascript 'abc'.slice(-2);