-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nice day #2389
base: FabriceAB1
Are you sure you want to change the base?
Nice day #2389
Conversation
added calculator.js
Thank you for the submission, @FabriceAB1! I'll review your code shortly, hang tight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
_check
function to ensure that bothx
andy
are numbers.divide
function to prevent division by zero.module.exports
statement to export the functions as a module.This pull request implements the
_check
function to validate input numbers for theadd
,subtract
,multiply
, anddivide
functions. The_check
function checks if both inputs are numbers and throws aTypeError
if 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
divide
function to prevent division by zero.Changes
_check
function to validate input numbersdivide
function to prevent division by zeroTests
npm test
to ensure all tests pass_check
function correctly throws errors for invalid inputChecklist
_check
functiondivide
functionnpm test
to ensure all tests passRelated Issues
Notes