The examples in this article describe js string operation methods. Share it with everyone for your reference. The details are as follows:
var str="This is my first Script code."; document.write("原字符串为:"+str+"<br>") document.write("第五个字符之后的部分:"+str.slice(5,-1)+"<br>"); document.write("第五个字符之后的15个字符:"+str.substr(5,15)+"<br>"); document.write("第五个字符后至第15个字符:"+str.substring(5,15)+"<br>");
I hope this article will be helpful to everyone’s JavaScript programming design.