//JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。
function Num(init) {
function Num2(init) {
if (new.target !== null) {
this.count = init
this.add = (a) => {
this.count = this.count + a
return this
}
this.build = () => {
return this.count
}
}
}
return new Num2(init)
}
console.log(Num(5).add(5).build())