js怎样截取字符串后几位以及截取字符串前几位
作者:互联网
var disName ='开心一族漂亮家园'; var shortName = disName.substring(0,5); console.log(shortName);//打印结果:开心一族漂 截取字符串后几位 var disName ='开心一族漂亮家园'; var disLength = disName.length; var shortName = disName.substring(disLength-2,disLength); console.log(shortName);//打印结果:家园
标签:disLength,disName,截取,家园,几位,var,字符串,shortName 来源: https://www.cnblogs.com/yuan9580/p/16117618.html