Q:

I`m trying to build a 90 degree triangle, with numbers, using only two nested for loops

I must draw a 90 degree triangle with numbers, using two nested for() loops at most, in plain JavaScript. Now, I've managed to draw the triangle, the only problem is, it`s an iteration from 1 to 9 and on each separate row, I need to have the same number, repeat itself as many times that number! Keep in mind, maximum two nested for loops, no more!
I have stumbled upon solutions for this problem, but they were all using three nested for() loops, instead of two, as I need it to be...

function generatePyramid() {
  var f, k;
  for (f = 1; f <= 9; f++) {
    for (k = 1; k <= f; k++) {
      document.write(k);
    }
    document.write("<br>");
  }
}
generatePyramid();

I`m getting:
1
12
123
1234
12345
123456
1234567
12345678
123456789

while I want to have:
1
22
333
4444
55555
666666
7777777
88888888
999999999

A:

one loop :P

for(let i=1; i<=9; i++) document.write( (''+i).repeat(i)+'</br>' );

