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

֢٘ ߡ੹ী ٮۄ ௑ࣛ ղਊ੉ ׮ܳ ࣻ ੓णפ׮  ղਊ੉ ցޖ ݆ই ઴৓૑݅  global ё୓ উীח ࣻभ о૑੄

         ࣘࢿ੉ ׸ѹ ੓णפ׮  ݽف ঌ ೙ਃח হਵ޲۽  ੗઱ ࢎਊೞח ࣘࢿٜ݅ ੉ ੺ীࢲ ঌইࠇפ׮

         ੹৉ ё୓ۄח ੼ਸ ੉ਊೞৈ ౵ੌ рী рױೠ ؘ੉ఠܳ ҕਬೡ ٸ ࢎਊೞӝب ೤פ׮  HMPCBM" KT৬ HMPCBM# K
         Tܳ э਷ ಫ؊ী ࢤࢿ೧ࠇद׮


          globalA.js
           module.exports	=	()	=>	global.message;




          globalB.js

           const	A	=	require('./globalA');


           global.message	=	'안녕하세요';
           console.log(A());




         globalA ݽٕ੄ ೣࣻח global.message чਸ ߈ജ೤פ׮  globalB jsীࢲח global ё୓ী ࣘࢿݺ੉ message
         ੋ чਸ ؀ੑೞҊ globalA ݽٕ੄ ೣࣻܳ ഐ୹೤פ׮  ௑ࣛ Ѿҗח globalBীࢲ ֍਷ global.message чਸ glo

         balAীࢲب ੽Ӕೡ ࣻ ੓਺ਸ ࠁৈસפ׮

          콘솔

           $	node	globalB
           안녕하세요





              8BSOJOH HMPCBM ё୓੄ թਊ

           global ё୓੄ ࣘࢿী чਸ ؀ੑೞৈ ౵ੌ рী ؘ੉ఠܳ ҕਬೡ ࣻ ੓૑݅  ੉ܳ թਊೞ૑ח ݃ࣁਃ  ೐۽Ӓ۔੄ ӏݽо ழ૕
           ࣻ۾ যڃ ౵ੌীࢲ global ё୓ী чਸ ؀ੑ೮ח૑ ଺ӝ ൨ٜযઉ ਬ૑ ࠁࣻী য۰਑ਸ ѻѱ غӝ ٸޙੑפ׮  ׮ܲ ౵ੌ੄

           чਸ ࢎਊೞҊ र׮ݶ ݽٕ ഋधਵ۽ ٜ݅যࢲ ݺद੸ਵ۽ чਸ ࠛ۞৬ ࢎਊೞח Ѫ੉ જणפ׮




          
          
               DPOTPMF

         ૑Әө૑ ࢎਊ೮؍ consoleب ֢٘ীࢲח window ؀न global ё୓ উী ٜয ੓ਵݴ  ࠳ۄ਋੷ীࢲ੄ console
         җ Ѣ੄ ࠺त೤פ׮


         console ё୓ח ࠁా ٣ߡӦਸ ਤ೧ ࢎਊ೤פ׮  ѐߊೞݶࢲ ߸ࣻী ч੉ ઁ؀۽ ٜয ੓ח૑ ഛੋೞӝ ਤ೧ ࢎ
         ਊೞҊ  ী۞ ߊࢤ द ী۞ ղਊਸ ௑ࣛী ಴दೞӝ ਤ೧ ࢎਊೞݴ  ௏٘ प೯ दрਸ ঌইࠁ۰Ҋ ೡ ٸب ࢎਊ೤

         פ׮  ؀಴੸ਵ۽ console.log ݫࢲ٘о ੓णפ׮  console.logח ૑ӘԈ ҅ࣘ ࢎਊ೮ਵ޲۽ ੊ࣼೡ Ѫੑפ׮
   80   81   82   83   84   85   86   87   88   89   90