SOURCE

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

const numOfWays = countStairways(20);
console.log("楼梯的走法数量:", numOfWays);
console 命令行工具 X clear

                    
>
console