147
rated 0 times
[
154]
[
7]
/ answers: 1 / hits: 145504
/ 11 Years ago, mon, december 23, 2013, 12:00:00
Here is the code to display pyramid but its not exactly producing required output.
function generatePyramid() {
var totalNumberofRows = 5;
var arr = new Array();
for (var i = 1; i <= totalNumberofRows; i++) {
for (var j = 1; j <= i; j++) {
arr.push(j);
console.log(j);
}
console.log(n);
}
}
More From » for-loop