You are viewing a single comment's thread. Return to all comments →
Nice! I didn't think to use repeat method. I did it this way, instead:
function main() { var n = parseInt(readLine()); let hashes = 1; let spaces = n - 1; for (; spaces > -1; n -= 1, spaces = n - 1, hashes += 1) { console.log(Array(spaces).fill(' ').concat(Array(hashes).fill('#')).join('')); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Staircase
You are viewing a single comment's thread. Return to all comments →
Nice! I didn't think to use repeat method. I did it this way, instead: