Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda