GithubHelp home page GithubHelp logo

export-named-exports's Introduction

Export-Named-Exports

Named exports are also distinct in that they can be exported as soon as they are declared, by placing the keyword export in front of variable declarations.

In menu.js

export let specialty = ''; export function isVegetarian() { }; function isLowSodium() { }; The export keyword allows us to export objects upon declaration, as shown in export let specialty and export function isVegetarian() {}. We no longer need an export statement at the bottom of our file, since this behavior is handled above.

QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ

Let’s add some additional data to our airplane.js file.

Continue by adding more data to objects within the availableAirplanes variable.

To the first object AeroJet, add a property maxSpeed with a value of 1200 and a property minSpeed with a value of 300.

To the second object SkyJet, add a property maxSpeed with a value of 800 and a property minSpeed with a value of 200.

Hint let availableAirplanes = [ {name: 'AeroJet', fuelCapacity: 800, availableStaff: ['pilots', 'flightAttendants', 'engineers', 'medicalAssistance', 'sensorOperators'], maxSpeed: 1200, minSpeed: 300 }, {name: 'SkyJet', fuelCapacity: 500, availableStaff: ['pilots', 'flightAttendants'], maxSpeed: 800, minSpeed: 200 } ]; 2. Within the flightRequirements object, add a property requiredSpeedRange and set this equal to 700.

Hint let flightRequirements = { requiredStaff: 4, requiredSpeedRange: 700 }; 3. Continuing with the same file, add a new function meetsSpeedRangeRequirements() that takes three arguments maxSpeed, minSpeed and requiredSpeedRange.

Hint function meetsSpeedRangeRequirements(maxSpeed, minSpeed, requiredSpeedRange) { };

Within the meetsSpeedRangeRequirements function, create a variable range, and set it to the difference between maxSpeed and minSpeed.

Hint function meetsSpeedRangeRequirements(maxSpeed, minSpeed, requiredSpeedRange) { let range = maxSpeed - minSpeed; }; 5. In the body of the meetsSpeedRangeRequirements() function, create logic to check if the range is greater than the requiredSpeedRange.

The function should contain this logic:

if the range is greater than the requiredSpeedRange return true else return false

Hint function meetsSpeedRangeRequirements(maxSpeed, minSpeed, requiredSpeedRange) { let range = maxSpeed - minSpeed; if (range > requiredSpeedRange) { return true; } else { return false; } }; 6. Use export to export the variables as soon as they are declared, and remove the export statement at the bottom of the file.

Hint export let availableAirplanes = [...];

export let flightRequirements = {...};

export function meetsStaffRequirements(){ ... };

export function meetsSpeedRangeRequirements(){ ... };

export-named-exports's People

Contributors

mikeyhodl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.