📜  function range() as range js - Javascript代码示例

📅  最后修改于: 2022-03-11 15:01:51.402000             🧑  作者: Mango

代码示例3
function range(start, end, interval = 0) {
        let arr = [];
        interval = interval > 0 ? interval-1 : 0
        for (let i = start; i < end; i++) {
             arr.push(i)
             i+=interval;
        }
        return arr
    }
// example range(0 , 100 , 5)