Skip to content

Commit a8c0f7b

Browse files
committed
Optimized adder
1 parent dae5da6 commit a8c0f7b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

JavaScript/b-adder.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
const adder = (a) => ({
4+
value() {
5+
return a;
6+
},
7+
add(b) {
8+
a += b;
9+
return this;
10+
}
11+
});
12+
13+
const v = adder(3).add(-9).add(12).value();
14+
console.log(v);

0 commit comments

Comments
 (0)