Answers for "js stairs algorithm"

1

js stairs algorithm

function staircase(n) {
    let filledArray = new Array(n).fill(' ');
    while (filledArray.indexOf(' ') !== -1) {
        filledArray.shift();
        filledArray.push('#');
        console.log(filledArray.join(""));
        n--;
    }
}
Posted by: Guest on October-27-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language