There is just one problem here. I see you wanted to add “newline characters”, but what the exercise ment by that is to really add a newline (and not display the newline character). You can do so or by using the newline character or by using templates literals.
Anything else is good ! Hope this helped, enjoy coding !
Little exercises like the pyramid generator are great for really understanding loops and how string building works in JavaScript. At first it feels simple, but once you start controlling spacing and alignment it actually forces you to think carefully about the logic. Debugging each step of the loop usually makes the pattern much clearer.