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