Page 59 - Nodejs 교과서 개정2판
P. 59

const	add2	=	(x,	y)	=>	{
           		return	x	+	y;
           };


           const	add3	=	(x,	y)	=>	x	+	y;


           const	add4	=	(x,	y)	=>	(x	+	y);


           function	not1(x)	{
           		return	!x;
           }


           const	not2	=	x	=>	!x;




         add1  add2  add3  add4ח э਷ ӝמਸ ೞח ೣࣻੑפ׮  ݃ଲо૑۽ not1  not2ب э਷ ӝמਸ ೤פ׮  ച࢓಴
         ೣࣻীࢲח function ࢶ঱ ؀न => ӝഐ۽ ೣࣻܳ ࢶ঱೤פ׮  ژೠ  ߸ࣻী ؀ੑೞݶ ա઺ী ੤ࢎਊೡ ࣻ ੓ण

         פ׮

         ച࢓಴ ೣࣻীࢲ ղࠗী returnޙ߆ী হח ҃਋ীח returnޙਸ ઴ੌ ࣻ ੓णפ׮  ઺Қഐ ؀न add3җ add4

         ୊ۢ returnೡ धਸ ߄۽ ੸ਵݶ ؾפ׮  add4୊ۢ ࠁӝ જѱ ࣗҚഐ۽ хव ࣻب ੓णפ׮  not2୊ۢ ݒѐ߸ࣻ
         о ೠ ѐݶ ݒѐ߸ࣻܳ ࣗҚഐ۽ ޘয઱૑ ঋইب ؾפ׮  returnޙਸ ઴੉ח ޙߨ਷ ੗઱ ࢎਊೞ޲۽ ׀ৈѹࠁ

         ӡ ߄ۉפ׮

         ӝઓ functionҗ ׮ܲ ੼਷ this ߄ੋ٘ ߑधੑפ׮  ׮਺ ৘ઁܳ ࠇद׮




           var	relationship1	=	{
           		name:	'zero',
           		friends:	['nero',	'hero',	'xero'],
           		logFriends:	function	()	{
           				var	that	=	this;	//	relationship1을	가리키는	this를	that에	저장
           				this.friends.forEach(function	(friend)	{
           						console.log(that.name,	friend);
           				});
           		},
           };
           relationship1.logFriends();


           const	relationship2	=	{
           		name:	'zero',
           		friends:	['nero',	'hero',	'xero'],
           		logFriends()	{
           				this.friends.forEach(friend	=>	{
   54   55   56   57   58   59   60   61   62   63   64