#######
######
#####
####
###
##
#
The above question is the problem from the book eloquent javascript. But the question was different as:
Write a loop that makes seven calls to console.log to output the following triangle:
#
##
###
####
#####
######
#######
But I need a solution for the exact reverse of this by using the logic below:
for (let line = "#"; line.length < 8; line += "#")
console.log(line);
The below is the code snippet which I tried as above logic but doesn't work as above:
for (let line = "#######"; line.length > 0; line -= "#")
console.log(line);
Anyone can give me the solution by using the same logic and where I went wrong?