September 06, 2021
example - ์ ์ฐจ ์งํฅ ๋ฐฉ์
let baseSalary = 3000;
let overtime = 10;
let rate = 20;
function getWage(baseSalary, overtime, rate) {
return baseSalaray + (overtime * rate);
}
example - ๊ฐ์ฒด ์งํฅ ๋ฐฉ์
let employee = {
baseSalary: 3000,
overtime: 10,
rate: 20,
getWage: function() {
return this.baseSalary + (this.overtime * this.rate);
}
}
์ถ์ํ๋ฅผ ํตํด ๊ฐ๋จํด์ง๋ ์ธํฐํ์ด์ค
์ถ์ํ๋ฅผ ํตํด ๋ณํ์ ์ํฅ์ ์ค์
example - ์ ์ฐจ ์งํฅ ๋ฐฉ์
switch(...) {
case 'select':
renderSelect();
break;
case 'text':
renderTextBox();
break;
case 'checkbox':
renderCheckBox();
break;
default:
break;
}
example - ๊ฐ์ฒด ์งํฅ ๋ฐฉ์
element.render();