Observe the following:
let gamesArray = ['Shadow of the Beast 2', 'Flashback', 'Turricain 2', 'Gods', 'Speedball 2', 'First Samurai', 'Beneath a steal sky', 'Magic Pockets', 'Superfrog', 'Final Fight'];
let [Game_1, Game_2, Game_3, Game_4, Game_5, Game_6, Game_7, Game_8, Game_9, Game_10] = gamesArray;
console.log(Game_8); // Magic Pockets
console.log("\n");
I was wondering that if we were unpacking 10 array elements as separate variables and wanted to call them Game_[an incremented number] how would we go about it ? I was trying a few things by running the code in Atom text editor with JS enabled.
obviously a small array is easy to unpack and refer back to as opposed to an array with ten elements as seen in the above example.
Anybody got any ideas ?