1.0.2 • Published 2 years ago

calculador v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

calculador

Introduction:

This is a simple calculator function written in JavaScript. It performs mathematical calculations based on the operator passed as an argument. The function can perform addition, subtraction, multiplication and division. It's written in a way that allows for easy reuse and can be called multiple times with different arguments.

Operators:

  • "+" for addition
  • "-" for subtraction
  • "*" for multiplication
  • "/" for division

Example:

"Divide between two numbers":
function divide(a, b) {
  if (b === 0) {
    return "Cannot divide by 0";
  }
  result =  a / b;
  console.log(` The result is: ${result}`);
}

divide(10,5); // The result is: 2

Exports:

module.exports = {
   add,
   subtract,
   multiply,
   divide,
   calculate
}

How to use:

  1. installing -
 npm install calculador
  1. using -
const x = require('calculador');
x.name of the function(a,b);

Important Note:

If you are using the 'calculate' function You need to put 3 arguments (a,b,"operator").

For example:

calculate(10,5,"/") //The result is: 2

Created By Dor Amrami And Yogev Nahum

1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago