Modules lesson

Hello everyone.

I’m doing the JS part of the web development course and I stumbled at a very strange issue. For some reason using arrow functions syntax and backtick literals won’t allow me to pass to the next part of the lesson. Here I show the code so you can see, compare displayStaffStatus with displaySpeedRangeStatus:

import {availableAirplanes, flightRequirements, meetsStaffRequirements, meetsSpeedRangeRequirements} from ‘./airplane’;

const displayFuelCapacity = () => {

availableAirplanes.forEach((element)=>{

console.log(`Fuel capacity of ${element.name}: ${element.fuelCapacity}`);

})

};

const displayStaffStatus = () => {

availableAirplanes.forEach((element)=>{

console.log(`${element.name} meets staff requirements: ${meetsStaffRequirements(element.availableStaff, flightRequirements.requiredStaff)}`);

})

};

function displaySpeedRangeStatus() {

availableAirplanes.forEach(function(element){

console.log(element.name + ' meets speed range requirements: ' + meetsSpeedRangeRequirements(element.maxSpeed, element.minSpeed, flightRequirements.requiredSpeedRange));

});

};

displayFuelCapacity();

displayStaffStatus();

displaySpeedRangeStatus();

Basically the result is exactly the same but the first example won’t allow me to keep going . It’s like it’s forcing me to use a particular syntax? Or am I missing something here?

No, you’re not missing anything. It’s the LE which is at fault.

I didn’t like the Modules section of that course, mainly because at points you’re required to use ES5 syntax but aren’t adequately told that ES6 will not be accepted. I spent a fair bit of time on that lesson metaphorically pulling my hair out because code I was confident was right failed to pass. I doubt you and I are the only people to run into this and find it frustrating. :frowning:

Arrow functions are an ES6 feature, and so you’ll likely not be able to use them throughout the lesson on modules. You can certainly try and code your answers using arrow syntax, but be prepared to refactor if it’s not accepted. :slight_smile:

1 Like

Hey! thanks for letting me know. At least now I know I’m not just insane (although I was close to becoming insane). :laughing:

1 Like

No worries, that lesson drove me up the wall a bit too! :smiley:

1 Like