QP School

Full Version: JavaScript exercises and solutions - Iterating through an array with keys and values
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
const Games =
      [
        "Assetto Corsa",
        "Assetto Corsa Competizione",
        "rFactor",
        "rFactor2",
        "Kart Racing Pro",
        "KartKraft",
        "vRally",
        "WRC 10",
        "F1 2023",
        "F1 2022",
        "F1 2021",
        "F1 2020",
        "F1 2019",
        "F1 2018",
        "F1 2017",
        "F1 2016",
        "F1 2015",
        "F1 2014",
        "F1 2013",
        "F1 2012",
      ];

for(i = 0; i < Games.length; i++)
  {
    document.write(i + " ");
    document.write(Games[i] + "<br>");
  }