Skip to content

Commit 0c3e274

Browse files
committed
completed add without +
1 parent 0a9ac6f commit 0c3e274

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

DailyCode/add

Lines changed: 0 additions & 1 deletion
This file was deleted.

DailyCode/add/add-without-plus.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function add(a, b){
2+
while(b!=0){
3+
carry = a & b
4+
5+
a = a ^ b
6+
7+
b = carry << 1
8+
}
9+
return a
10+
}
11+
12+
console.log(add(5, 7))

0 commit comments

Comments
 (0)