Skip to main content
Formatting
Source Link
forsvarir
  • 11.7k
  • 6
  • 38
  • 71

No need to declare loads of variables.

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

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))
    }
}
deleted 25 characters in body
Source Link

Hi here is a very short wayNo need to solve the problem hope it helpsdeclare loads of variables.

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

Hi here is a very short way to solve the problem hope it helps.

`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))
    }
}`
Source Link

Hi here is a very short way to solve the problem hope it helps.

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