This project is a simple calculator implemented in JavaScript, allowing users to perform basic arithmetic operations and generate a random ID.
-
Function:
add(a, b)
-
Description: Adds two numbers (
a
andb
) and returns the result.
-
Function:
sub(a, b)
-
Description: Subtracts the second number (
b
) from the first number (a
) and returns the result.
-
Function:
mul(a, b)
-
Description: Multiplies two numbers (
a
andb
) and returns the result.
-
Function:
div(a, b)
-
Description: Divides the first number (
a
) by the second number (b
) and returns the result.
-
Function:
uid()
- Description: Generates a random alphanumeric ID.
-
Include the calculator module in your JavaScript project:
const { add, sub, mul, div, uid } = require('./simple-calculator');