This community-built FAQ covers the “Import as” exercise from the lesson “Intermediate JavaScript Modules”.
Paths and Courses
This exercise can be found in the following Codecademy content:
Web Development
Introduction To JavaScript
FAQs on the exercise Import as
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply (
) below!
Agree with a comment or answer? Like (
) to up-vote the contribution!
Need broader help or resources? Head here.
Looking for motivation to keep learning? Join our wider discussions.
Learn more about how to use this guide.
Found a bug? Report it!
Have a question about your account or billing? Reach out to our customer support team!
None of the above? Find out where to ask other questions here!
import{aircrafts, flightReqs, meetsStaffReqs, meetsSpeedRangeReqs} from './airplane';
function displayFuelCapacity(){
aircrafts.forEach(function(element){
console.log('Fuel capacity of '+element.name+':' + element.fuelCapacity);
});
}
displayFuelCapacity();
function displayStaffStatus(){
aircrafts.forEach(function(element){
console.log(element.name + 'meets staff requirements: ' + meetsStaffReqs(element.availableStaff, flightReqs.requiredStaff));
});
}
function displaySpeedRangeStatus(){
aircrafts.forEach(function(element){
console.log(element.name+ 'meets speed range requirements: ' + meetsSpeedReqs(element.maxSpeed, element.minSpeed, flightReqs.requiredSpeedRange));
});
}
displayStaffStatus();
displaySpeedRangeStatus();
``` I still get an error but I get go next though Did I do something wrong?
1 Like
I think this one is just busted.
2 Likes
The solution in this one is wrong. the names of objects and functions are not modified. bruh…?
1 Like
Uh what?
The stacktrace doesn’t match up at all with what’s written.
This whole export/import module is flaky and long winded.
3 Likes
Solution 1’s Hint gives error because of single quotation that will give you error if you’re looking for the answer
function displaySpeedRangeStatus() {
aircrafts.forEach(function(element) {
console.log(element.name'<-------(Remove this Single Quote and everything will work) + ' meets speed range requirements: ' + meetsSpeedRangeReqs(element.maxSpeed, element.minSpeed, flightReqs.requiredSpeedRange));
});
}
displaySpeedRangeStatus();
So solution should look like this:
function displaySpeedRangeStatus(){
aircrafts.forEach(function(element){
console.log(element.name + 'meets speed range requirements: ’ + meetsSpeedRangeReqs(element.maxSpeed,element.minSpeed,flightReqs.requiredSpeedRange));
});
};
displaySpeedRangeStatus();