JS
var arr = new Array(1,2,3,4,5); var ret = arr.slice(2,4); //3,4
If only one argument is provided, the subarray will be the specified postion to the end of array.
var arr = new Array(1,2,3,4,5); var ret = arr.slice(2); //3,4,5
The argument with negative value represents its position relative to the last element.
var arr = new Array(1,2,3,4,5); var ret = arr.slice(2,-1); //3,4 ret = arr.slice(-2,-1); //4
var str = "javascript endmemo"; alert(str.substr(5)); //cript endmemo alert(str.substr(5,10)); //cript endm