๋ฐ์ํ JavaScript168 [Node.js-์ํ์ฝ๋ฉ] JavaScript - callback [์ถ์ฒ-Youtube ์ํ์ฝ๋ฉ] https://www.youtube.com/watch?v=5GVvn9xiG5g&list=PLuHgQVnccGMA9QQX5wqj6ThK7t2tsGxjm&index=38 syntax/callback.js /* function a(){ console.log('A'); } */ var a = function(){ console.log('A'); } function slowfunc(callback){ callback(); } slowfunc(a); โ ์ค์ํ ๋ถ๋ถ!! ์ด๋ ค์ฐ๋ ๋ค์ ๋ณต์ตํ ๊ฒ 2021. 1. 29. [Node.js-์ํ์ฝ๋ฉ] ๋๊ธฐ์ ๋น๋๊ธฐ 2 [์ถ์ฒ-Youtube ์ํ์ฝ๋ฉ] https://www.youtube.com/watch?v=7woGFlMhSgk&list=PLuHgQVnccGMA9QQX5wqj6ThK7t2tsGxjm&index=37 syntax/sample.txt B syntax/sync.js var fs = require('fs'); /* //readFileSync console.log('A'); var result = fs.readFileSync('syntax/sample.txt', 'utf8'); console.log(result); console.log('C'); */ console.log('A'); fs.readFile('syntax/sample.txt', 'utf8', function(err, result){ // ํจ์๋ฅผ 3๋ฒ.. 2021. 1. 29. [Node.js-์ํ์ฝ๋ฉ] ๋๊ธฐ์ ๋น๋๊ธฐ [์ถ์ฒ-Youtube ์ํ์ฝ๋ฉ] https://www.youtube.com/watch?v=3eOGYLxropQ&list=PLuHgQVnccGMA9QQX5wqj6ThK7t2tsGxjm&index=36 ๋๊ธฐ - ์์ ์ ์์ฐจ์ ์ผ๋ก ์งํ. ์์ ์ด ์ค๋ ๊ฑธ๋ ค๋ ๋๋ ๋๊น์ง ๊ธฐ๋ค๋ ธ๋ค๊ฐ ๋ค์ ์์ ์งํ. ๋น๋๊ธฐ - ๋ณ๋ ฌ์ ์ผ๋ก ๋์์ ์ผ์ ์ฒ๋ฆฌ. ํจ์จ์ ์ด์ง๋ง ๋งค์ฐ ๋ณต์กํจ. โ Node.js๋ ๋น๋๊ธฐ์ ์ฒ๋ฆฌ๋ฅผ ํ๊ธฐ ์ํ ์ข์ ๊ธฐ๋ฅ๋ค์ ๊ฐ์ง๊ณ ์์. 2021. 1. 29. [Node.js-์ํ์ฝ๋ฉ] App ์ ์ - ํจ์๋ฅผ ์ด์ฉํด์ ์ ๋ฆฌ ์ ๋ํ๊ธฐ [์ถ์ฒ-Youtube ์ํ์ฝ๋ฉ] https://www.youtube.com/watch?v=TtVxkScVmUc&list=PLuHgQVnccGMA9QQX5wqj6ThK7t2tsGxjm&index=34 main.js var http = require('http'); var fs = require('fs'); var url = require('url'); function templateHTML(title, list, body){ return ` WEB ${list} ${body} `; } function templateList(filelist){ var list = ''; var i = 0; while(i < filelist.length){ list = list + `${filelist[i]}`; i = i .. 2021. 1. 28. [Node.js-์ํ์ฝ๋ฉ] JavaScript - ํจ์์ ์ถ๋ ฅ [์ถ์ฒ-Youtube ์ํ์ฝ๋ฉ] https://www.youtube.com/watch?v=OXGGA-rh__0&list=PLuHgQVnccGMA9QQX5wqj6ThK7t2tsGxjm&index=33 syntax/function2.js console.log(Math.round(1.6)); // 2 console.log(Math.round(1.4)); // 1 function sum(first, second){ return first+second; } console.log(sum(2,4)); return์ ๋ง๋๋ฉด ์ถ๋ ฅ ํ ํจ์๋ ์ฆ์ ์ข ๋ฃ๋๋ค. 2021. 1. 28. [Node.js-์ํ์ฝ๋ฉ] JavaScript - ํจ์์ ์ ๋ ฅ [์ถ์ฒ-Youtube ์ํ์ฝ๋ฉ] https://www.youtube.com/watch?v=c3Pail1Iitc&list=PLuHgQVnccGMA9QQX5wqj6ThK7t2tsGxjm&index=32 syntax/function2.js console.log(Math.round(1.6)); // 2 console.log(Math.round(1.4)); // 1 function sum(first, second){ // ์ ์ console.log(first+second); } sum(2,4); // ํธ์ถ ์ ์, ์ ์ธ, ํธ์ถ ๊ฐ๋ ํ์คํ ์์๋ ๊ฒ ํธ์ถ์ ๋จผ์ ํ๊ณ ์ ์๋ ์ ์ธ์ ํ๋๊ฒ ๋ ผ๋ฆฌ์ ์ผ๋ก ๋ง๋ค. (์ ์ฝ๋๋ ์ ์ ๋จผ์ ํ๊ณ ํธ์ถํจ) 2021. 1. 28. ์ด์ 1 ยทยทยท 21 22 23 24 25 26 27 28 ๋ค์ ๋ฐ์ํ