Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Nasah-Kuma
Last active September 28, 2022 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nasah-Kuma/da5187cc3b3017582edcba724b85668d to your computer and use it in GitHub Desktop.
Save Nasah-Kuma/da5187cc3b3017582edcba724b85668d to your computer and use it in GitHub Desktop.
/*
* Complete the 'staircase' function below.
*
* The function accepts INTEGER n as parameter.
*/
function staircase(n) {
// Write your code here
let newString = '';
let j = n-1;
let i = n;
while (i>0) {
newString += '#';
console.log(' '.repeat(j)+newString);
i--;
j--;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment