Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript - multiple complex if statements
    text
    copied!<p>Im struggling with multiple complex statements in javaScript and wondered if anyone could point me in the right direction.</p> <pre><code> function findFlights() { var yourDestination = readTheDestination(); var yourAirline = readTheAirline(); var yourFare = readTheFare(); if (yourDestination == 'Choose your destination') { displayMessage('&lt;B&gt;Please choose a destination city from the Destination menu and then click Find flights again.&lt;/B&gt;'); } else { var destinationTime, destinationOperator, destinationFare; var message = '&lt;B&gt;You asked about flights to ' + yourDestination + '&lt;/B&gt;&lt;BR&gt;' + ""; for (var i=0; i &lt; flightTimes.length; i++) //flight destinations { if // statement // IF flight: ((flightDestinations[i] == yourDestination &amp;&amp; // destination = selected destination &amp; yourAirline == 'Any airline' &amp;&amp; // airline = any airline &amp; yourFare == 'Any price')) // fare &lt;= chosen fare || // OR (flightDestinations[i] == yourDestination &amp;&amp; // destination = selected destination &amp; yourAirline == flightOperators[i] &amp;&amp; // airline = chosen airline &amp; yourFare &lt;= flightFares[i])) // fare &lt;= chosen fare { destinationTime = flightTimes[i]; destinationOperator = flightOperators[i]; destinationFare = flightFares[i]; message += destinationTime + ' ' + destinationOperator + '. £' + destinationFare + '&lt;BR&gt;'; displayMessage(message); } } else if (flightDestinations[i] == yourDestination &amp;&amp; flightOperators[i] != yourAirline &amp;&amp; flightFares[i] != yourFare) { displayMessage('There are no flights to ' + yourDestination + ' with ' + yourAirline + '. Please select Any Airline and try again.'); } } </code></pre> <p>This is what I have so far and its making me gray.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload