function calc(val = 0) {
const self = {
add: v => (val += v, self),
sub: v => (val -= v, self),
mul: v => (val *= v, self),
div: v => (val /= v, self),
pow: v => (val **= v, self),
toString: () => val,
};
return self;
}
calc().add(5).mul(5) + 1 // 26
+calc(100).div(10).sub(2) // 8
`${calc(2).pow(10)}` // "1024"