Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

pyramid javascript

function generatePyramid() {
    var totalNumberofRows = 5;
    var output = '';
    for (var i = 1; i <= totalNumberofRows; i++) {
        for (var j = 1; j <= i; j++) {
            output += j + '  ';
        }
        console.log(output);
        output = '';
    }
} generatePyramid();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pyramid #javascript
ADD COMMENT
Topic
Name
9+7 =