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

134
Views
Information won't show up in my console log

Code won't print in my console log. Why? I am trying to print things from a dataset but it won't print for some reason.

function totalPassengers(airportName) {
  var airport = getColumn("Busiest Airports", "Airport");
  var passengers = getColumn("Busiest Airports", "Total Passengers");
  for (var i = 0; i < airport.length; i++) {
    if (airport[i] == (airport[i] == airportName) ) {
return passengers[i];
    }
  }
}
console.log("The amount of passengers in this airport was: "+ getProperty("text_input1", "text") + totalPassengers());
function airport(airportName) {
  var airports = getColumn("Busiest Airports", "Airport Code");
  for (var i = 0; i < airports.length; i++) {
    if (airport[i] == airportName) {
      return (airports[i]);
    }
  }
}
console.log("The code of this airport is: " + airport);

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Not quite enough data from the code right now, but we can probably assume that the totalPassengers function should return the number of passengers at a certain airport.

I advise you to pay attention to the if condition. Because the condition if (airport[i] == (airport[i] == airportName)) is probably not correct, I think it should be something like if (airport[i] === airportName).

It seems to me that the first function should be like this:

function totalPassengers(airportName) {
  const airport = getColumn("Busiest Airports", "Airport");
  const passengers = getColumn("Busiest Airports", "Total Passengers");
  for (let i = 0; i < airport.length; i++) {
    if (airport[i] === airportName) {
       return passengers[i];
    }
  }
}

console.log(totalPassangers("NAME OF THE AIRPORT"));

As for the last line with console.log, you forgot to add the closing brackets and the argument.

console.log("The code of this airport is: " + airport("NAME OF THE AIRPORT"));
about 4 years ago · Juan Pablo Isaza Report
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!