1.substring(start,end) 不包括end本身;如果start>end,两者的位置互换;如果start(或end)小于0,则变为0
var str = "Hello world!";
var res = str.substring(1,4); 

返回的结果是:ell

 

2.substr(start,end)包括end本身

var str = "Hello world!";
var res = str.substr(1,4) 

res表示ello

 

3.slice(start,end)包括end本身

var str = "Hello world!";
var res = str.slice(1,5); 

The result of res will be:

ello