Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 53514d9

Browse filesBrowse files
All operation test cases pass
1 parent 2dbb7d7 commit 53514d9
Copy full SHA for 53514d9

File tree

Expand file treeCollapse file tree

3 files changed

+13
-9
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+13
-9
lines changed

‎operations/arithmethics/operations.js

Copy file name to clipboardExpand all lines: operations/arithmethics/operations.js
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const twoSum = function(a, b) {
99

1010
//Adding Infinite sum of numbers
1111
const addAll = function() {
12+
if(arguments.length < 2) return "Input at least two Number";
13+
1214
let total = 0;
1315
for (let arg in arguments) {
1416
let loop = typeof arguments[arg] === "number";
@@ -33,6 +35,9 @@ const subtract = function(a, b) {
3335

3436
//Multiplication Operation
3537
const multiply = function() {
38+
39+
if(arguments.length < 2) return "Input at least two Number";
40+
3641
let total = 1;
3742
for (let arg in arguments) {
3843
let loop = typeof arguments[arg] === "number";
@@ -46,6 +51,8 @@ const multiply = function() {
4651
return total;
4752
};
4853

54+
55+
4956
//Division Operation
5057
const divide = function(a, b) {
5158
return arguments.length < 2 || arguments.length > 3

‎operations/arithmethics/operations.test.js

Copy file name to clipboardExpand all lines: operations/arithmethics/operations.test.js
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ describe("Testing add operation for Infinite numbers", () => {
3131
it("Addition of multiple value", () => {
3232
expect(addAll(11, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10)).toBe(73);
3333
});
34+
it("Parameter should at least be two", () => {
35+
expect(addAll(1)).toMatch(/least two Number/);
36+
});
3437
it("Parameter should only be Numbers", () => {
3538
function logError() {
3639
addAll([], 2, 3, 4, 5, 6, 7, 8, 8, 9, 10);
@@ -75,6 +78,9 @@ describe("Testing Multiply implimentation for infinite number", () => {
7578
it("Multiplication of 1132 and 1131331", () => {
7679
expect(multiply(1132, 1131331)).toBe(1280666692);
7780
});
81+
it("Parameter should at least be two", () => {
82+
expect(multiply(1)).toMatch(/least two Number/);
83+
});
7884
it("All parameter should only be Numbers", () => {
7985
function logError() {
8086
multiply([], 2, 3, 4, 5, 6, 7, 8, 8, 9, 10);

‎operations/git_api/db.js

Copy file name to clipboard
-9Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
module.exports.getCustomer = function(id) {
22
return { id: id, points: 12 };
33
};
4-
5-
6-
7-
let check = function(a,b,c) {
8-
console.log(arguments.length)
9-
}
10-
check(1,2)
11-
12-
console.log(1 < 2) //1 less than 2

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.