const soo = { firstName: "lucy", lastname:"soo", Birthday:1900, job:"front-end developer", ageCalc : function(Birthday) { return 2021 - Birthday; } };
console.log(soo.ageCalc(1991)); -> 30
console.log(soo['ageCalc'](1991)); -> 30
.이나 []로 function 지정해줘도 값은 같게 나옴
혹은 this를 지정해줘서 파라미터를 설정하지 않아도 값은 같게 나옴
ageCalc: function(){
return 2021-this.Birthday;
}
}; -> 30