ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Import Named Imports
    Study/JavaScript 2020. 5. 14. 19:19

    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';

    import {availableAirplanes, flightRequirements, meetsStaffRequirements,meetsSpeedRangeRequirements} from './airplane';
    
    function displayFuelCapacity() {
      availableAirplanes.forEach(function(element){
      console.log('Fuel Capacity of ' + element.name + ': ' + element.fuelCapacity);
      });
    }
    
    displayFuelCapacity();
    
    function displayStaffStatus() {
      availableAirplanes.forEach(function(element) {
       console.log(element.name + ' meets staff requirements: ' + meetsStaffRequirements(element.availableStaff, flightRequirements.requiredStaff) );
      });
    }
    
    displayStaffStatus();
    
    function displaySpeedRangeStatus() {
      availableAirplanes.forEach(function(element) {
       console.log(element.name + ' meets speed range requirements: ' + meetsSpeedRangeRequirements(element.maxSpeed, element.minSpeed, flightRequirements.requiredSpeedRange));
      });
    }
    
    displaySpeedRangeStatus();

    'Study > JavaScript' 카테고리의 다른 글

    Import as  (0) 2020.05.14
    Export as  (0) 2020.05.14
    Export Named Exports  (0) 2020.05.14
    Named Exports  (0) 2020.05.14
    import  (0) 2020.05.14

    댓글

Designed by Tistory.