JavaScript (Export as 11 of 15)


#1

Hi,

I keep getting an error message stating ‘Did you use export each variable as its alias’. However, I think I have done so if anyone could show where I am going wrong that would be great please

Syntax for exercise is below:

export { availableAirplanes as aircrafts, flightRequirements as flightReqs, meetsStaffRequirements as meetsStaffReqs, meetsSpeedRangeRequirements as meetsSpeedRangeReqs } from './airplane';

function meetsSpeedRangeReqs () {
  
}

function meetsSpeedRangeRequirements () {
  
}

function meetsStaffRequirements () {
  
}

function flightRequirements () {
  
}

function availableAirplanes () {
  
} 
function displayStaffStatus() {
 
  
  availableAirplanes.forEach(function(element) {
  
    console.log(element.name + ' meets staff requirements: ' + 
                meetsStaffRequirements(element.availableStaff, 
                                       flightRequirements.requiredStaff) );
 
  });

}

displayStaffStatus()

displaySpeedRangeStatus(); 

Link to the exercise: https://www.codecademy.com/courses/intermediate-javascript-modules/lessons/modules/exercises/export-as?action=resume_content_item&course_redirect=introduction-to-javascript


#2

I don’t recall that being part of this lesson. Try removing it.


#3

okay so it’s now: export { availableAirplanes as aircrafts, flightRequirements as flightReqs, meetsStaffRequirements as meetsStaffReqs, meetsSpeedRangeRequirements as meetsSpeedRangeReqs };

But now this is the error code I get if this helps at all:

/home/ccuser/workspace/intermediate-javascript_modules-airplanes/missionControl.js:25
availableAirplanes.forEach(function (element) {
^

TypeError: availableAirplanes.forEach is not a function
at displayStaffStatus (missionControl.js:29:22)
at Object. (missionControl.js:39:1)
at Module._compile (module.js:571:32)
at loader (/home/ccuser/node_modules/babel-register/lib/node.js:158:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/ccuser/node_modules/babel-register/lib/node.js:168:7)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Function.Module.runMain (module.js:605:10)
at /home/ccuser/node_modules/babel-cli/lib/_babel-node.js:171:48


#4

Are you sure availableAirplaines isn’t supposed to be an array of objects?


#5

Sorry, only just been able to get back round to this in my spare time. But yeah, it’s definitely not supposed to be an Array. Anyway, I’ve done it now, just followed steps 1 and 2 again and its worked right away without any setbacks haha (possibly could have been a bug last week b/c I never got any errors about the Array this time round which is strange)

  • Thank you anyway :slight_smile: