Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JavaScript exercises and solutions - Iterating through an array with keys and values
#1
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>");
  }
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  JavaScript - Array find() example (returns the value) Qomplainerz 0 541 04-04-2023, 08:12 AM
Last Post: Qomplainerz
  JavaScript Array findIndex() examples (returns the index) Qomplainerz 0 479 04-04-2023, 08:10 AM
Last Post: Qomplainerz
  JavaScript - Additions with values Qomplainerz 0 511 04-04-2023, 08:05 AM
Last Post: Qomplainerz
  JavaScript - Subtractions with values Qomplainerz 0 500 04-04-2023, 08:04 AM
Last Post: Qomplainerz
  JavaScript - Multiplications with values Qomplainerz 0 489 04-04-2023, 08:02 AM
Last Post: Qomplainerz
  JavaScript - Divisions with values Qomplainerz 0 477 04-04-2023, 08:00 AM
Last Post: Qomplainerz
  JavaScript - Exponentiations with values Qomplainerz 0 496 04-04-2023, 07:59 AM
Last Post: Qomplainerz
  JavaScript - Modulus with values Qomplainerz 0 468 04-04-2023, 07:57 AM
Last Post: Qomplainerz
  JavaScript exercises and solutions - Identify if a number is odd or even Qomplainerz 0 374 04-04-2023, 07:56 AM
Last Post: Qomplainerz
  JavaScript exercises and solutions - Swap two numbers Qomplainerz 0 399 04-04-2023, 07:54 AM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 5 Guest(s)