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

module.exports	=	{
           		odd,
           		even,
           };




         WBS KTী ߸ࣻ ف ѐܳ ࢶ঱೮णפ׮  ӒܻҊ module.exportsী ߸ٜࣻਸ ׸਷ ё୓ܳ ؀ੑ೮णפ׮  ੉ઁ ੉ ౵
         ੌ਷ ݽٕ۽ࢲ ӝמ೤פ׮  ߸ٜࣻਸ ݽইك ݽٕ੉ غח Ѫ੉ભ  ׮ܲ ౵ੌীࢲ ੉ ౵ੌਸ ࠛ۞য়ݶ module.ex

         portsী ؀ੑػ чਸ ࢎਊೡ ࣻ ੓णפ׮

         ੉ߣীח WBS KTܳ ଵઑೞח GVOD KTܳ ੘ࢿೞѷणפ׮


          func.js
           const	{	odd,	even	}	=	require('./var');


           function	checkOddOrEven(num)	{
           		if	(num	%	2)	{	//	홀수면
           				return	odd;
           		}
           		return	even;
           }


           module.exports	=	checkOddOrEven;





         require ೣࣻ উী ࠛ۞ৢ ݽٕ੄ ҃۽ܳ ੸णפ׮  ਤ ৘ઁীࢲח э਷ ಫ؊ উী ౵ੌਸ ٜ݅঻૑݅  ׮ܲ ಫ
         ؊ী ੓ח ౵ੌب ݽٕ۽ ࢎਊೡ ࣻ ੓णפ׮  require ೣࣻ੄ ੋࣻ۽ ઁҕೞח ҃۽݅ ੜ ૑੿ೞݶ ؾפ׮  ౵

         ੌ ҃۽ীࢲ KTա KTPO э਷ ഛ੢੗ח ࢤۚೡ ࣻ ੓णפ׮

         ৘ઁ ௏٘ীࢲ require ೣࣻ۽ WBS KTী ੓؍ чٜਸ ࠛ۞য়Ҋ ੓णפ׮  const	{	odd,	even	}਷      ੺ীࢲ

         ࢸݺೠ &4      ޙߨੑפ׮  WBS KT੄ module.exportsী ׸ѹ ੓؍ ё୓ܳ ࠛ۞৬ GVOD KTীࢲ ࢎਊೞח ݽण
         ੑפ׮


         WBS KTীࢲ ߸ࣻܳ ࠛ۞ৡ ٍ  ं੗੄ ഓ૟ਸ ౸߹ೞח ೣࣻܳ ࢶ঱೮णפ׮  ӒܻҊ ׮द module.exportsী ೣ
         ࣻܳ ؀ੑ೮णפ׮  ੉ۧѱ ׮ܲ ݽٕ WBS KT ਸ ࢎਊೞח ౵ੌਸ ׮द ݽٕ GVOD KT ۽ ٜ݅ ࣻ ੓णפ׮  ژೠ  m

         odule.exportsীח ё୓݅ ؀ੑ೧ঠ ೞח Ѫ੉ ইפۄ ೣࣻա ߸ࣻܳ ؀ੑ೧ب ؾפ׮

         ݃૑݄ਵ۽ JOEFY KTܳ ੘ࢿ೤פ׮

          index.js

           const	{	odd,	even	}	=	require('./var');
           const	checkNumber	=	require('./func');


           function	checkStringOddOrEven(str)	{
   76   77   78   79   80   81   82   83   84   85   86