1
1
//Addition Operation
2
2
const twoSum = function ( a , b ) {
3
3
return arguments . length < 2 || arguments . length > 3
4
- ? "Input only two Numbers"
5
- : typeof a === "number" && typeof b === "number"
6
- ? a + b
7
- : "Inputs Must be Numbers" ;
4
+ ? "Input only two Numbers"
5
+ : typeof a === "number" && typeof b === "number"
6
+ ? a + b
7
+ : "Inputs Must be Numbers" ;
8
8
} ;
9
9
10
10
//Adding Infinite sum of numbers
@@ -25,10 +25,10 @@ const addAll = function() {
25
25
//Subraction Operation
26
26
const subtract = function ( a , b ) {
27
27
return arguments . length < 2 || arguments . length > 3
28
- ? "Input only two Numbers"
29
- : typeof a === "number" && typeof b === "number"
30
- ? a - b
31
- : "Inputs Must be Numbers" ;
28
+ ? "Input only two Numbers"
29
+ : typeof a === "number" && typeof b === "number"
30
+ ? a - b
31
+ : "Inputs Must be Numbers" ;
32
32
} ;
33
33
34
34
//Multiplication Operation
@@ -49,15 +49,19 @@ const multiply = function() {
49
49
//Division Operation
50
50
const divide = function ( a , b ) {
51
51
return arguments . length < 2 || arguments . length > 3
52
- ? "Input only two Numbers"
53
- : typeof a === "number" && typeof b === "number"
54
- ? a / b
55
- : "Inputs Must be Numbers" ;
52
+ ? "Input only two Numbers"
53
+ : typeof a === "number" && typeof b === "number"
54
+ ? a / b
55
+ : "Inputs Must be Numbers" ;
56
56
} ;
57
57
58
58
//String Concatenation Operation
59
59
const joinString = function ( a , b ) {
60
- return typeof a === "string" && typeof b === "string" ? a . concat ( b ) : false ;
60
+ return arguments . length < 2 || arguments . length > 3
61
+ ? "Input only two String"
62
+ : typeof a === "string" && typeof b === "string"
63
+ ? a . concat ( b )
64
+ : "Inputs Must be String" ;
61
65
} ;
62
66
63
67
module . exports = { twoSum, addAll, subtract, multiply, divide, joinString } ;
0 commit comments