Hi there @Bob_Oy, and welcome to the community!
You’ve done really well here — this was quite a tough assignment. Your code works great, and you have used
forEach() rather nicely.
In terms of the problem that caused you to use
pop(). Your use of
forEach is correct, but inside it you are building a new string that you then split. When you’ve built the string, you end up with a comma on the end of it. This is ecause for each item in the array, you are running this:
txt = txt + value + ' ('+ index +'),';
and you are not removing the comma at the end of it before you then split it.