function generaterArray(min,max,step){ let len = Math.abs(max - min); if(len <= 0) return []; let arr = new Array(len); let cNum = min; let cIndex = 0; function addArr(index,val){ if(cNum >= min && cNum <= max){ arr[index] = cNum; cNum++; cIndex++; addArr(cIndex,cNum) } } addArr(cIndex,cNum); return arr.filter(item => item%step == 0); } console.log(generaterArray(-1,19,3))
。