https://youtu.be/KfuyXQLFNW4
코딩앙마님 강의 정리
onst mike = {
name: "Mike"
};
function showThisName() {
console.log(this.name);
}
showThisName.call(mike); //this === mike
function update(year, occupation) {
this.birthYear = year;
this.occupation = occupation;
}
update.call(mike, 1999, "singer");
console.log(mike); //name: "Mike", birthYear: 1999, occupation: "singer"}
update.apply(mike, [2000, "singer"]);
console.log(mike); //{name: "Mike", birthYear: 2000, occupation: "singer"}
const mike = {
name: "Mike"
};
function update(birthYear, job) {
this.birthYear = birthYear;
this.job = job;
}
const updateMike = update.bind(mike);
updateMike(1997, "police");
console.log(mike);
//{name: "Mike", birthYear: 1997, job: "police"}