编辑代码

function count(n,max){
    if(n<=max){
        return n+count(++n,max);
    }
    return 0;
}
console.log(count(1,100))