Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
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)) } }`
`function staircase(n) { let a = "#"; for(let i =1;i<=n;i++){ console.log(" ".repeat(n-i)+a.repeat(i)) } }`
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 wayNo need to solve the problem hope it helpsdeclare loads of variables.
Hi here is a very short way to solve the problem hope it helps.