| 1 | class Chain { |
| 2 | constructor(val) { |
| 3 | this.val = val; |
| 4 | } |
| 5 | |
| 6 | add(b) { |
| 7 | this.val += b |
| 8 | return this; |
| 9 | } |
| 10 | |
| 11 | sub(b) { |
| 12 | this.val -= b; |
| 13 | return this; |
| 14 | } |
| 15 | |
| 16 | mul(b) { |
| 17 | this.val *= b; |
| 18 | return this; |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | console.log((new Chain(5)).add(5).sub(2).mul(10)); |
nothing calls this directly
no outgoing calls
no test coverage detected