Skip to Content
Learn
Intermediate JavaScript Modules
Import Named Imports

To import variables that are declared, we simply use the original syntax that describes the variable name. In other words, exporting upon declaration does not have an impact on how we import the variables.

import { specialty, isVegetarian } from 'menu';

Instructions

1.

Add meetsSpeedRangeRequirements to the import statement at the top of the file.

2.

Define a function displaySpeedRangeStatus().

3.

Within the displaySpeedRangeStatus() function, use the forEach method to iterate over each element in the availableAirplanes array.

Again, the forEach() should take a function as a parameter; this function should take element as a parameter.

4.

Within the displaySpeedRangeStatus() function, use console.log() to output the element’s name.

5.

Continuing within the displaySpeedRangeStatus() function, modify the console.log() statement to output a statement like this:

(element name) + 'meets speed range requirements: ' + (true/false)

To do this, we can call the meetsSpeedRangeRequirements method, passing in three parameters element.maxSpeed, element.minSpeed and flightRequirements.requiredSpeedRange.

6.

Call the displaySpeedRangeStatus() function.

Folder Icon

Take this course for free

Already have an account?