所以我在 javascript 中有一个字符串
var s="may the force";
我只想要力部分, 在 python 中我可以做 s[4:],所以有 javascript 中有任何等价物吗?
力
s[4:]
请您参考如下方法:
你可以使用:
var s = "may the force"; var t = s.substring(4); alert(t); //alerts "the force"
检查这个Fiddle