Code playground help

Hello, I’m trying to write a code that follows these instructions:
Part 1
There is an array with 3 elements. It should loop through the elements for a given number of times and choose one at random, then add it to another array.
In this way I would create an array (named “end” with, say, 20 elements taken from the first three (so they repeat multiple times).

Part 2
It should count how many times the three elements repeat each other in the “end” array. So let say the elements are fork spoon and knife. It should say “there are x spoons, y knives ecc.”

I’m stuck with part one!
I add an

I actually have a very limited idea on your plan but I would like to point out some mistakes…

First of all ,. += is used to add numbers
That means in order to add a string into an array you will have to used .push command (sadly, this command is not available in the code playground :frowning:)

I think you have the wrong idea of the classical for…loop

for (let i = 0 , i < 15, i++) {
print(i) }

The above code prints the values of i and does not work in the way you think

The above code will print
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

I hope you do understand, but don’t worry the solution to your problem will be provided soon by the staff. Good luck.

Thank you @ParkleZ! Some things are clearer now.
I have to keep in mind that += is just for numbers. But if I can’t use the .push command (why is it that? And could I use it, in “real life” JavaScript?).
I think I now get the idea of how the classic for…loop works. I’ll try with a for…of loop