Page 60 - Nodejs 교과서 개정2판
P. 60
console.log(this.name, friend);
});
},
};
relationship2.logFriends();
relationship1.logFriends উ forEachޙীࢲח function ࢶޙਸ ࢎਊ೮णפ п ܲ ೣࣻ झ
thisܳ о۽ thatۄח ߸ࣻܳ ࢎਊ೧ࢲ relationship1ী рਵ۽ ӔೞҊ णפ
ೞ݅ relationship2.logFriends() উ forEachޙীࢲח ച ೣࣻܳ ࢎਊ೮णפ ٮۄࢲ ߄Ӵ झ
ੋ MPH'SJFOET thisܳ Ӓ۽ ࢎਊೡ ࣻ णפ ࢚ਤ झ thisܳ Ӓ۽ ޛ۰߉ח Ѫੑפ
ӝࠄਵ۽ ച ೣࣻܳ ॳغ thisܳ ࢎਊ೧ঠ ೞח ҃ীח ച ೣࣻ৬ ೣࣻ ࢶޙ(function)
ীࢲ ೞաܳ Ҋܰݶ ؾפ
ҳઑ࠙೧ ೡ
ҳઑ࠙೧ ೡਸ ࢎਊೞݶ ё৬ ߓৌ۽ࠗఠ ࣘࢿա ਃࣗܳ औѱ ԁյ ࣻ णפ
ё ࣘࢿਸ э ܴ ߸ࣻী ੑೞח ٘ੑפ
var candyMachine = {
status: {
name: 'node',
count: 5,
},
getCandy: function () {
this.status.count--;
return this.status.count;
},
};
var getCandy = candyMachine.getCandy;
var count = candyMachine.status.count;
٘ܳ җ э ߄Ե ࣻ णפ
const candyMachine = {
status: {
name: 'node',
count: 5,