Conversation
added calculator.js
Thank you for the submission, @FabriceAB1! I'll review your code shortly, hang tight. |
dantharejabot
left a comment
There was a problem hiding this comment.
This is a great attempt, @FabriceAB1!
I would like to request a few changes before merging your work. Please review my comments below and make the appropriate changes to your code.
After you update your code locally, follow the instructions to save your changes locally and push your changes to your fork.
When you push your changes to your fork, I'll come back for another review.
There are 1 style guide violations in your contribution. I've marked them with inline comments for your convenience.
Please revisit your code and follow the style guide best practices.
Hint: You might be able to fix some issues automatically by running npm run lint -- --fix
All the tests are passing. Nice job!
Deleted all content calculator.js
Added this code:
To implement the _check function to make the tests pass, you can modify the code as follows:
Here is the regenerated code with all the information above:
This code includes:
_checkfunction to ensure that bothxandyare numbers.dividefunction to prevent division by zero.module.exportsstatement to export the functions as a module.This pull request implements the
_checkfunction to validate input numbers for theadd,subtract,multiply, anddividefunctions. The_checkfunction checks if both inputs are numbers and throws aTypeErrorif either input is not a number.Additionally, this pull request includes JSDoc comments for each function to provide documentation and clarity. The code also includes error handling for the
dividefunction to prevent division by zero.Changes
_checkfunction to validate input numbersdividefunction to prevent division by zeroTests
npm testto ensure all tests pass_checkfunction correctly throws errors for invalid inputChecklist
_checkfunctiondividefunctionnpm testto ensure all tests passRelated Issues
Notes