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))
}
}
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))
}
}