Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
How do I read out an 2d array in JavaScript with values and print it in a label with a button

My plan is that you put in a value like [1][2] which should be the car in the middle. Then start with a button and output the color of the car.

I have tried this but it doesn't work:

function printcars() {

  let garage = [
    ["hellrot", " blau", " türkis"],
    [" braun", " minzgrün", " schwarz"],
    [" silber", " pink", " dunkelrot"]
  ];

  var k = "The respective values are :";

  function Geeks() {
    var input = document.getElementsByName('garage[]');

    for (let i = 0; i < garage.length; i++) {
      for (let j = 0; j < garage[i].length; j++) {
        var a = input[i];
        var b = input[j];
        k = k + "garage[" + i + "].value= "
          + a.value + " ";
      }

      document.getElementById("par").innerHTML = k;
      document.getElementById("po").innerHTML = "Output";
    }
  }
}

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!