You are specifying something like
"Track7" in the code, but there is no answer at this rate. Who knows if there will be more than 7 tracks or less?
So what you're going to do now is make the first one, the second one on the given playlist, and the third one, the second one... And if you're going to make the first one the last one, I'll approach it with the
shift concept. If you look at how
shift() in the JS Array works, you'll see that the code below makes sense.
If it's in the opposite direction, look for
unshift. Anyway, this approach has the advantage of mechanically circulating the entire array, so you don't have to hardcode things like
"Track7". Look into it!
© 2022 pinfo. All rights reserved.