---
"Categories":
- |-
Vue.js
- |-
JavaScript
"Tags":
- |-
Vue.js
- |-
JavaScript
"date": |-
2020-01-03
"title": "Vue.js \uCF54\uB529 \uACF5\uC791\uC18C"
"type": |-
book
---
<script type="text/javascript"> (function() { function Calc(xInput, yInput, output) { -- calc 인스턴스를 만드는 생성자입니다. this.xInput = xInput; this.yInput = yInput; this.output = output; } Calc.xName = 'xInput'; Calc.yName = 'yInput'; Calc.prototype = { render: function (result) { this.output.innerText = String(result); } }; function CalcValue(calc, x, y) { -- calc 인스턴스 값들을 만드는 생성자입니다. this.calc = calc; this.x = x; this.y = y; this.result = x + y; } CalcValue.prototype = { copyWith: function(name, value) { var number = parseFloat(value); if (isNaN(number) || !isFinite(number)) return this; if (name = = = Calc.xName) return new CalcValue(this.calc, number, this.y); if (name = = = Calc.yName) return new CalcValue(this.calc, this.x, number); return this; }, render: function() { this.calc.render(this.result); } };