I'm looking for advice on whether this is the best data structure for what Im trying to achieve, and if so, how I would create a function that chooses a song at random.
var song = {
john: [ "Come Together", "Revolution" ],
paul: [ "Hey Jude", "Blackbird" ],
george: [ "Something", "Here Comes the Sun" ],
ringo: [ "Yellow Submarine", "With a Little Help from my Friends" ]
};
Here's how it will work:
- Timer begins when the user clicks start
- A song (picked at random), is displayed onscreen
- User then clicks one of four icons/names (john, paul, george or ringo)
- Answer is logged (correct or incorrect).
- Another song is picked at random until the timer finishes.
I don't want a solution to this problem, I just want to know if I'm using the best data structure...and if I am (or if I'm not!), how I'd go about generating a random song. I'm new to this and what I'm trying to do is way more complicated than anything I've tried before. Final point...John and Paul's individual arrays are going to be pretty damn long when the song list is complete...
Thanks!