用于python a的javascript简写[1:]

use*_*607 1 javascript python string substring

所以我在javascript中有一个字符串

var s="may the force";
Run Code Online (Sandbox Code Playgroud)

而我只想要the force部分,在python中我可以做s[4:],所以在javascript 中有任何等价物吗?

Sim*_*ock 7

你可以使用:

var s = "may the force";
var t = s.substring(4);

alert(t); //alerts "the force"
Run Code Online (Sandbox Code Playgroud)

检查这个小提琴