SOURCE

function numWays(n) {
    if (n <= 2) {
        return n;
    }
    return numWays(n - 1) + numWays(n - 2);
}

console.log(numWays(7))
console 命令行工具 X clear

                    
>
console