es6

06. Maths πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

πŸ› Implement Modules

Work with a partner to resolve the following issue(s):

  • Users should be able to import and use the maths.js module to execute simple math operations.

Expected Behavior

  • When I run node index.js sum 3 4 in the command line, it should print out 7.

  • When I run node index.js difference 3 4 in the command line, it should print out -1.

  • When I run node index.js product 3 4 in the command line, it should print out 12.

  • When I run node index.js quotient 3 4 in the command line, it should print out 0.75.

Actual Behavior

  • Nothing happens when I run the commands because the index.js file is empty.

Steps to Reproduce the Problem

  1. Navigate to the Unsolved folder in the command line.

  2. Run node index.js sum 3 4 in the command line.

Instructions

Follow the prompts in the index.js file to complete the expected behaviour.

πŸ’‘ Hint

What will the parseInt() method allow us to do?

πŸ† BONUS

If you have completed this activity, work through the following challenge with your partner to further your knowledge:

  • How can you export functions and objects directly?

Use Google or another search engine to research this.


βœ… Solutions

Solutions Click Here