12-19-2018, 07:47 AM
(This post was last modified: 12-19-2018, 07:50 AM by Shirley245.)
I am learning coding for javascript. I created pyramids in console the one that i am not able to achieve is
1
123
12345
1234567
123456789
Thanks for any help
Quote:function fnAlphabet(num){
var result = '';
for (var i = 1; i <= num; i++) {
console.log(i);
for(var j = i; j <= num; j++){
result += j + ' ';
}
console.log(result);
}
}
fnAlphabet(5);
1
123
12345
1234567
123456789
Thanks for any help