Thursday, 26 November 2015

Output triangle using loops in javascript

Output triangle using loops in javascript
Write a loop that makes seven calls to console.log to output the  triangle like in the picture:

for(var i=1; i<=7; i++){
    for(var j=1; j<=i; j++)
    {
     document.write("#");
        
    }
     document.write("
");
}

0 comments:

Post a Comment