Skip to content

Instantly share code, notes, and snippets.

@jaamaalxyz
Created August 12, 2018 06:35
Show Gist options
  • Save jaamaalxyz/eb94d92628aff597c5c7f1628c6c35c2 to your computer and use it in GitHub Desktop.
Save jaamaalxyz/eb94d92628aff597c5c7f1628c6c35c2 to your computer and use it in GitHub Desktop.
const add = (x, y) => (+x) + (+y);
const subtract = (x, y) => (+x) - (+y);
const multiply = (x, y) => (+x) * (+y);
const divide = (x, y) => (+x) / (+y);
// Input validation function
const validateNumbers = (x, y) => {
if (isNaN(x) || isNaN(y)) {
return false;
}
return true;
}
module.exports = {
add,
subtract,
multiply,
divide,
validateNumbers,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment