代码如下: var str="abcdefghhhh";//截取后4位 str.substring(str.length-4); 转载于:https://www.cnblogs.com/Mrrabbit/p/9230002.html