Skip to main content
3 of 3
Formatting
forsvarir
  • 11.7k
  • 6
  • 38
  • 71

No need to declare loads of variables.

function staircase(n) {
    let a = "#";
    for(let i =1;i<=n;i++){
        console.log(" ".repeat(n-i)+a.repeat(i))
    }
}