There are one line solutions to this, I’m sure. Does that make it better? The problem with super short answers like that is that they are often hard to read and understand. Yours is straight and too the point.
The only think I don’t like about yours is that you keep concatenating the string on each pass. JS needs to reallocate memory on each pass to do that. I might have put them in and array and then joined at the end, or just done it in situ in the array you created.
But still, it’s a good solution. But when you solve these, it’s often good to go out on the interwebs and see how other people solved them - it can be very instructive.
Thanks! “good enough” in my mind its something that don’t use bad practics, cuz when you study you will keep your solutions in mind and reuse them, so i dont want to memorize bad practics. Now i see that use arrays better, than using strings. Thanks