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