I am a beginner in the field of web development and seeking help in generating a specific output for a given problem:
var totalRows = 5;
var result = '';
for (var i = 1; i <= totalRows; i++) {
for (var j = 1; j <= i; j++) {
result += i;
}
console.log(result+' ');
result = '';
}
Output:
1
22
333
4444
55555
Expected Output:
1
22
333
55555
88888888
I need assistance in modifying my code to achieve the desired output. Can anyone provide guidance?