Problem Statement :
Input Format
A single integer ,n, denoting the size of the staircase.
Constraints: 0 < n <= 100
Output Format :
Print a staircase of size using # symbols and spaces.
Note: The last line must have spaces in it.
Example:
Sample Input : 6
Sample output
#
##
###
####
#####
######
Solution in javascript.
function staircase(n) {
// Write your code here
var line = '';
for(let i = 1; i <n +1; i++) {
line += Array(n-i).fill(' ').join('')
line += Array(i).fill('#').join('')
console.log(line)
line = ''
}
}
padStart
also can be used to solve this, for adding padding on string.developer.mozilla.org/en-US/docs/W...