//Slasher Flick //返回一个数组被截断n个元素后还剩余的元素,截断从索引0开始。 function slasher(arr, howMany) { // it doesn't always pay to be first var len=arr.length; if(howMany===0){ return arr; }else if(howMany>len){ return []; }else if(len-howMany===1){ return [arr[howMany]]; }else{ return [arr[howMany],arr[howMany+1]]; } } console.log(slasher([1, 2, 3], 2));