how to get the last four characters of a string efficiently in javascript code example Example: javascript get last n characters of string 'abc'.slice(-1); // c