I am a new web developer and need assistance generating a given output to a problem:
var totalNumberofRows = 5;
var output = '';
for (var i = 1; i <= totalNumberofRows; i++) {
for (var j = 1; j <= i; j++) {
output += i;
}
console.log(output+' ');
output = '';
}
Output:
1
22
333
4444
55555
Expected Output:
1
22
333
55555
88888888
How would I be able to make my code produce the target output?