Answers for "javascript pyramid"

2

number pyramid in javascript

// Display pyramid of number using JavaScript
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 = "";
}
Posted by: Guest on January-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language