万恶的输入法,在sublime中会显示出繁体字,各位看官见谅. 1.slice()方法:该方法在数组和string对象中都拥有. var a = [1,2,3,4,5,6]; var s = 'this is a string'; console.log(a.slice(1,3));//結果為 [2,3]; console.log(a.slice(-1);//結果為6; console.log(s.slice(1,3));//結果為 hi; console.log(s);//結果為 this i…