📅  最后修改于: 2022-03-11 15:02:18.710000             🧑  作者: Mango
function staircase(n) {
let space = []
let stair = "#"
let result
for (let i = 1; i <= n; i++) {
space.push(' '.repeat(i))
}
let rotateSpace = space.reverse()
for(let j = 1; j <= n; j++) {
result = rotateSpace[j - 1] + stair.repeat(j)
console.log(result.replace(' ', ''))
}
}