代码如下:

var str="abcdefghhhh";//截取后4位
str.substring(str.length-4);