UNPKG
yash-nodeapp
Version:
latest (1.5.0)
1.5.0
sample nodejs application created as part of nodeJs training
yash-nodeapp
/
calculator.js
17 lines
(16 loc)
•
275 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function
add
(
a,b
){
return
a+b; }
function
subtract
(
a,b
){
return
a-b; }
function
multiply
(
a,b
){
return
a*b; }
function
divide
(
a,b
){
if
(b===
0
)
throw
new
Error
(
"cannot divide by 0"
); }
module
.
exports
={ add,subtract,multiply,divide }