๐ŸŸจ JavaScript/๊ธฐํƒ€

    ๊ฐ€์žฅ ์ตœ์‹ ์˜ jquery ๋งํฌ

    script src="http://code.jquery.com/jquery-latest.min.js">script>

    console.clear();

    ๊ฐœ๋ฐœ์ž๋ชจ๋“œ๋ฅผ ํ™œ์šฉํ•ด ๊ณต๋ถ€ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋ฉด ์ฝ˜์†”๋กœ๊ทธ๋ฅผ ์ „์ฒด์‚ญ์ œํ•  ์ˆ˜ ์žˆ๋‹ค. console.clear();

    [๋“œ๋ฆผ์ฝ”๋”ฉ] IIFE (์ฆ‰์‹œ ํ˜ธ์ถœ๋˜๋Š” ํ•จ์ˆ˜ ๋งŒ๋“ค๊ธฐ)

    function sayHello(){ console.log('Hello'); } sayHello(); ์ฆ‰์‹œ ํ˜ธ์ถœ๋˜์–ด์•ผ ํ•˜๋Š” ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค ๊ฒฝ์šฐ ์•„๋ž˜์ฒ˜๋Ÿผ ํ•œ๋ฒˆ ๋” ํ˜ธ์ถœํ•ด์ค˜์•ผ ํ•˜๋Š” ๋ฒˆ๊ฑฐ๋กœ์›€์ด ์žˆ๋‹ค. ์ด๋ฅผ IIFE (Immediately Invoked Function Expression)์„ ํ†ตํ•ด ๋” ์‰ฝ๊ฒŒ ํ˜ธ์ถœํ•  ์ˆ˜ ์žˆ๋‹ค. (function sayHello(){ console.log('Hello'); })(); ํ•จ์ˆ˜๋ฅผ ()๊ด„ํ˜ธ๋กœ ๊ฐ์‹ธ๊ณ  ();๋ฅผ ๋ถ™์ด๋ฉด ๋œ๋‹ค.

    [๋“œ๋ฆผ์ฝ”๋”ฉ] ๋””๋ฒ„๊น… ํŒ - named function, recursions

    * named function์€ class์™€ object์— ๊ด€ํ•œ ๊ฐœ๋…์ •๋ฆฌ ๊ฒŒ์‹œ๊ธ€์—์„œ ํ•œ๋ฒˆ ๋” ์–ธ๊ธ‰ํ•œ๋‹ค. const printGood = function () { console.log('Good'); } ์ผ๋ฐ˜์ ์ธ ์ด๋Ÿฐ ํ•จ์ˆ˜์„ ์–ธ๋ฌธ์—์„œ, function ์˜†์— ์ด๋ฆ„์„ ๋ถ™์—ฌ์ฃผ์–ด (named function) ๋””๋ฒ„๊น…ํ•  ๋•Œ ํ•จ์ˆ˜ ์ด๋ฆ„์ด ๋‚˜์™€์„œ ๋””๋ฒ„๊น…์„ ๋” ์†์‰ฝ๊ฒŒ ํ•  ์ˆ˜ ์žˆ๋‹ค. const printGood = function print() { console.log('Good'); } ํ•จ์ˆ˜ ์•ˆ์—์„œ ํ•จ์ˆ˜๋ฅผ ๋ถ€๋ฅด๋Š” recursions๋„ ๋””๋ฒ„๊น… ์‹œ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. (๋ฐ˜๋ณต๋˜๋Š” ํ‰๊ท ๊ฐ’์„ ๊ณ„์‚ฐํ•˜๋Š” ๋“ฑ์˜ ๊ฒฝ์šฐ์— ์‚ฌ์šฉ) const printGood = function print() { console.log('Good'); print..

    [๋“œ๋ฆผ์ฝ”๋”ฉ] ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๊ณต์‹์‚ฌ์ดํŠธ (๊ณต๋ถ€ ์‹œ ์ฐธ์กฐ)

    ์‹ค์ œ ๊ณต์‹ ์‚ฌ์ดํŠธ ecma-international.org ๊ฐœ๋ฐœ์ž๊ฐ€ ๋ณด๊ธฐ์—๋Š” ์กฐ๊ธˆ ๋‚œํ•ดํ•˜๋‹ค๊ณ . ๊ฐ€์žฅ ๋งŽ์ด ๋ณด๋Š” ์‚ฌ์ดํŠธ (์ถ”์ฒœ) developer.mozilla.org ๊ฐ€์žฅ ๋งŽ์ด ์“ฐ์ด๋Š” mdn ์‚ฌ์ดํŠธ. ๊ณต์‹์‚ฌ์ดํŠธ X, ์ผ๋ฐ˜ ๊ธฐ์—…์ด ๋งŒ๋“  ์‚ฌ์ดํŠธ w3schools.com