Hello @Olixpin
The pop()
and push()
code is correct.
Regarding the loop:
Your first step to create the new element inside the loop is correct. The line // Don't edit the code below here!
does also mean we are not allowed to copy this code into our own code. These “untouchable” lines of code tell us the exercise expects a single string of all the data from the array inside the variable myString
.
I took the correct parts of your loop and added some pseudo code to help you understand the steps:
for(let i = 0; i < myArray.length; i++) {
const value = `${myArray[i]} ${i}`
/* Set the current array element to the new value */
}
/* Use the join() method of the array to create the myString variable */
Try to replace each of my comment lines with a single assignment. The resulting code is simpler than you may think. So don’t think to far. I hope that gives you enough support to solve the tasks. If not, just ask.
Happy coding,
Michael