Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
JohnAdemoye
Oluwaseyi
README.md

README.md

Project JavaScript K1 Modules

Topics: Hello Modules Module.exports I, require(), module.exports II, export default, import, Named Exports, Named Imports, Export Named Exports, Import Named Imports, Export as, Import as, Combining Export Statements, Combining Import Statements

Project Title: Resturant Menu

  1. Copy and Paste your folder from project M1 here

  2. You have this folder structure

  • your-name
    • src
    • prod
  1. Create a file named food.js in src folder.

  2. Define array food there and enter these items there:

Saffron.
Kale.
Clementine.
Peaches.
Nori.
Kobe.
Olive.
Rosemary.
  1. Export it as food

  2. Edit src/index.js to require food.js module and print food into console.

  3. Export a function named getSpecials in food.js to filter foods that start with N or end with e or at least have one r in their name.

  4. Use that function in the src/index.js and log into console.

  5. Define menu.js and define a class names menu and export default using ES sytanx.

  6. Fill items array as property in the class and fill it through constructor.

  7. Add method getAll to show all items.

  8. Import this class in src/index.js and make a new object and enter some menu items as parameter.

  9. Print all menu items through getAll functions.

  10. Add a named export to menu.js as getVeg function.

  11. This function return an arrays of 3 vegeterian foods.

  12. Use this named export in src/index.js and log foods into console.

Want to get reviewed?

Send Pull Request. Check how to deliver your code: https://codingwithbasir.com/how-to-deliver-projects/

Need help?

Download Learn JavaScript eBook from https://codingwithbasir.com/learn-javascript

You can’t perform that action at this time.