์ „์ฒด ๊ธ€ 30

[JS] Rest Syntax

1. Rest Syntax๋ž€?Rest Syntax๋Š” ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋  ๋•Œ ์ „๋‹ฌ๋œ ๋ชจ๋“  ์ธ์ž๋ฅผ ํ•˜๋‚˜์˜ ๋ฐฐ์—ด๋กœ ๋ฐ›์•„๋“ค์ด๋Š” ๋ฌธ๋ฒ•์ž…๋‹ˆ๋‹ค. ์ฆ‰, ํ•จ์ˆ˜์˜ ๋งค๊ฐœ๋ณ€์ˆ˜ ์•ž์— ...์„ ๋ถ™์ด๋ฉด, ํ•ด๋‹น ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” ๋‚˜๋จธ์ง€ ๋ชจ๋“  ์ธ์ž๋“ค์„ ๋ฐฐ์—ด๋กœ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.์˜ˆ์ œ:function f(...args) { const sum = args[0] + args[1]; return sum;}console.log(f(3, 4)); // 7f(3, 4)๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด, ํ•จ์ˆ˜ ๋‚ด๋ถ€์—์„œ args๋Š” [3, 4]๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.์ด์ฒ˜๋Ÿผ ํ•จ์ˆ˜์— ์ „๋‹ฌ๋œ ๋ชจ๋“  ์ธ์ž๋ฅผ ๋ฐฐ์—ด๋กœ ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค๋‹ˆ๋‹ค.2. ์™œ Rest Syntax๋ฅผ ์‚ฌ์šฉํ• ๊นŒ?์ฒ˜์Œ์—๋Š” "๊ทธ๋ƒฅ ๋ฐฐ์—ด์„ ํ•จ์ˆ˜์— ์ „๋‹ฌํ•˜๋ฉด ๋˜๋Š” ๊ฑฐ ์•„๋‹Œ๊ฐ€?"๋ผ๋Š” ์ƒ๊ฐ์ด ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ Rest Syntax๋Š” ๊ฐ€๋ณ€์ ์ธ..

[JS] Arrow Syntax vs Function Syntax

ํ•จ์ˆ˜๊ฐ€ ๊ฐ์ฒด๋ผ๋Š” ์‚ฌ์‹ค์€ ๋‹ค๋ฅธ ํ”„๋กœ๊ทธ๋žญ ์–ธ์–ด์™€ ๊ตฌ๋ณ„๋˜๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ์ค‘์š”ํ•œ ํŠน์ง•์ด๋‹ค.- ๋ชจ๋˜ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๋”ฅ๋‹ค์ด๋ธŒ, ์ด์‘๋ชจJS ์—์„œ ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๋กœ์ง์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์—”์ง„์€ ์ƒ์„ฑ๋œ ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์œ„ํ•ด ํ•จ์ˆ˜ ์ด๋ฆ„๊ณผ ๋™์ผํ•œ ์ด๋ฆ„์˜ ์‹๋ณ„์ž๋ฅผ ์•”๋ฌต์ ์œผ๋กœ ์ƒ์„ฑํ•˜๊ณ , ๊ฑฐ๊ธฐ์— ํ•จ์ˆ˜ ๊ฐ์ฒด๋ฅผ ํ• ๋‹นํ•จ์ผ๊ธ‰๊ฐ์ฒด์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ํ•จ์ˆ˜๋Š” ๊ฐ’์ฒ˜๋Ÿผ ๋ณ€์ˆ˜์— ํ• ๋‹น๋˜๊ฑฐ๋‚˜, ํ”„๋กœํผํ‹ฐ ๊ฐ’ ๋˜๋Š” ๋ฐฐ์—ด์˜ ์š”์†Œ๊ฐ€ ๋  ์ˆ˜ ์žˆ์Œ. ๊ฐ’์˜ ์„ฑ์งˆ์„ ๊ฐ–๋Š” ๊ฐ์ฒด๋ฅผ ์ผ๊ธ‰๊ฐ์ฒด ๋ผ๊ณ  ํ•จ// ๊ธฐ๋ช… ํ•จ์ˆ˜ ํ‘œํ˜„์‹var add = function foo (x,y) { return x+y;};// ํ•จ์ˆ˜ ๊ฐ์ฒด๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋Š” ์‹๋ณ„์ž๋กœ ํ˜ธ์ถœconsole.log(add(2,5)); //7// ํ•จ์ˆ˜ ์ด๋ฆ„์œผ๋กœ ํ˜ธ์ถœ -> ReferenceError// ํ•จ์ˆ˜ ์ด๋ฆ„์€ ํ•จ์ˆ˜ ๋ชธ์ฒด ๋‚ด๋ถ€์—์„œ๋งŒ ์œ ํšจํ•œ..

[LeetCode] 2667 create-hello-world-function

โœ” ๋ฌธ์ œ ๋งํฌhttps://leetcode.com/problems/create-hello-world-function/editorial/โœ” editorial ํ•™์Šต1. ์ต๋ช…ํ•จ์ˆ˜var f = function(a, b) { const sum = a + b; return sum;}console.log(f(3, 4)); // 7- ๋ฌด๊ธฐ๋ช… ํ•จ์ˆ˜ 2. ์ฆ‰์‹œ ์‹คํ–‰ ํ•จ์ˆ˜var res = (function () { var a = 3; var b = 5; return a + b;}())console.log(res); // 15res = (function (a, b) { return a * b;}(3, 5))console.log(res); // 15- ์ผ๋ฐ˜ ํ•จ์ˆ˜์ฒ˜๋Ÿผ ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ธ์ˆ˜..

[์›น] canonical url

๊ตฌ๊ธ€ ๊ณต์‹ ๊ฒ€์ƒ‰์—”์ง„ ์ตœ์ ํ™” ๋ฌธ์„œ ์ฐธ๊ณ  https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls?hl=ko#rel-canonical-link-method URL ํ‘œ์ค€ํ™” ๋ฐ ํ‘œ์ค€ ํƒœ๊ทธ | Google ๊ฒ€์ƒ‰ ์„ผํ„ฐ | ๋ฌธ์„œ | Google Developers ์‚ฌ์ดํŠธ์— ์ค‘๋ณต ์ฝ˜ํ…์ธ ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ Google์€ ํ‘œ์ค€ URL์„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค. ํ‘œ์ค€ URL ๋ฐ ์ค‘๋ณต URL ํ†ตํ•ฉ ๋ฐฉ๋ฒ•์„ ์ž์„ธํžˆ ์•Œ์•„๋ณด์„ธ์š”. developers.google.com - ํ•˜๋‚˜์˜ ํŽ˜์ด์ง€๋ฅผ ์—ฌ๋Ÿฌ URL๋กœ ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ๊ฑฐ๋‚˜ ์„œ๋กœ ๋‹ค๋ฅธ ํŽ˜์ด์ง€์— ์œ ์‚ฌํ•œ ์ฝ˜ํ…์ธ ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ(์˜ˆ: ํ•œ ํŽ˜์ด์ง€์— ๋ชจ๋ฐ”์ผ ๋ฒ„์ „๊ณผ ๋ฐ์Šคํฌํ†ฑ ๋ฒ„์ „์ด ๋ชจ๋‘ ์žˆ๋Š” ๊ฒฝ์šฐ) - Google์€ ์ด..

[์›น] Google AMP

AMP๋ž€ ๋ฌด์—‡์ธ๊ฐ€์š”? ์›น์‚ฌ์ดํŠธ ๋กœ๋“œ๊ฐ€ 3์ดˆ๋ฅผ ๋„˜์–ด๊ฐ€๋ฉด ์›น์‚ฌ์ดํŠธ์—์„œ ๋‚˜๊ฐ„๋‹ค๋Š” ์‚ฌ๋žŒ์ด 40% - ์‚ฌ์šฉ์ž์˜ ํœด๋Œ€๊ธฐ๊ธฐ์— ์ฝ˜ํ…์ธ ๊ฐ€ ๋กœ๋“œ๋˜๋Š” ์‹œ๊ฐ„์„ ์ค„์ด๊ธฐ ์œ„ํ•ด Google์—์„œ๋Š” Accelerated Mobile Pages ํ”„๋กœ์ ํŠธ๋ฅผ ์‹œ์ž‘ - ๋ชจ๋“  ์‚ฌ์šฉ์ž๋ฅผ ์œ„ํ•ด ๋ชจ๋ฐ”์ผ ์›น ์‚ฌ์šฉํ™˜๊ฒฝ์„ ๊ฐœ์„ ํ•˜๋Š” ๊ฒƒ์„ ๋ชฉํ‘œ๋กœ ํ•˜๋Š” ์˜คํ”ˆ์†Œ์Šค ํ”„๋กœ์ ํŠธ https://amp.dev AMP - a web component framework to easily create user-first web experiences Explore AMP success stories Don’t take our word for it - read case studies from industry success stories and see how AMP has pro..

[์›น] ๊ฒ€์ƒ‰์—”์ง„์ตœ์ ํ™”, SEO

๐Ÿ“Œ ๊ฒ€์ƒ‰์—”์ง„์ตœ์ ํ™”๋ž€?(SEO, Search Engine Optimization) ๊ฒ€์ƒ‰์—”์ง„์ด ์ดํ•ดํ•˜๊ธฐ ์‰ฝ๋„๋ก ํ™ˆํŽ˜์ด์ง€ ๊ตฌ์กฐ์™€ ํŽ˜์ด์ง€๋ฅผ ๊ฐœ๋ฐœํ•ด ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ์ƒ์œ„์— ๋…ธ์ถœ๋  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ์ž‘์—… ๐Ÿ“Œ ๊ฒ€์ƒ‰์—”์ง„ ์ตœ์ ํ™” ๊ฐ€์ด๋“œ๋ผ์ธ 1. ๋„ค์ด๋ฒ„ ๋ธ”๋กœ๊ทธ/์นดํŽ˜/์ง€์‹์ธ ์œ„์ฃผ๋กœ ์ฝ˜ํ…์ธ ๊ฐ€ ๋…ธ์ถœ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋™์ผํ•œ ๋‚ด์šฉ์˜ ์ฝ˜ํ…์ธ ์ผ ๋•Œ ๋„ค์ด๋ฒ„๊ฐ€ ์•„๋‹Œ ๋…๋ฆฝ์ ์ธ ํ™ˆํŽ˜์ด์ง€์— ์œ„์น˜ํ•œ ์ฝ˜ํ…์ธ ๋Š” ์ƒ์œ„์— ์ž˜ ๋…ธ์ถœ๋˜์ง€ ์•Š์Œ 2. ๊ตฌ๊ธ€ ํ™ˆํŽ˜์ด์ง€ ๊ด€๋ฆฌ์ž๋ฅผ ์œ„ํ•œ '์›น๋งˆ์Šคํ„ฐ'๋„๊ตฌ๋ฅผ ์ œ๊ณต. ํ•ด๋‹น ๋„๊ตฌ๋ฅผ ํ†ตํ•ด ํ˜„์žฌ ๊ตฌ๊ธ€ ๊ฒ€์ƒ‰์—”์ง„์ด ์ž์‹ ์˜ ํ™ˆํŽ˜์ด์ง€ ์ฝ˜ํ…์ธ ๋ฅผ ์–ด๋–ป๊ฒŒ ์ˆ˜์ง‘ํ•ด๊ฐ€๊ณ  ์žˆ๋Š”์ง€, ๊ฐ ํŽ˜์ด์ง€์— ์ธ๋ฑ์‹ฑ์ด ์ž˜ ๋˜๊ณ  ์žˆ๋Š”์ง€ ๋“ฑ์˜ ์ •๋ณด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Œ → ๋”ฐ๋ผ์„œ ๋„ค์ด๋ฒ„์™€ ๊ตฌ๊ธ€ ๋“ฑ ํ™ˆํŽ˜์ด์ง€๋ฅผ ์–ด๋–ค ๋ธŒ๋ผ์šฐ์ €์— ๋” ์ค‘์š”ํ•˜๊ฒŒ ๋…ธ์ถœํ•  ๊ฒƒ์ธ์ง€ ๊ฒฐ์ •ํ•ด์„œ SEO๋ฅผ ์ตœ์ ํ™”ํ•˜๋Š” ๊ฒƒ..

3way ํ•ธ๋“œ์‰์ดํฌ/4way ํ•ธ๋“œ์‰์ดํฌ

๐Ÿ“Œ TCP 3-way Handshake TCP๋Š” ์žฅ์น˜๋“ค ์‚ฌ์ด์— ๋…ผ๋ฆฌ์ ์ธ ์ ‘์†์„ ์„ฑ๋ฆฝ(establish)ํ•˜๊ธฐ ์œ„ํ•ด 3-way Handshake๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. 3-way Handshake๋ž€? TCP ํ†ต์‹ ์„ ์ด์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ•˜๊ธฐ ์œ„ํ•ด ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ์„ ์„ค์ •ํ•˜๋Š” ๊ณผ์ •์ด๋‹ค. ํด๋ผ์ด์–ธํŠธ, ์„œ๋ฒ„ ๋ชจ๋‘ ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ•  ์ค€๋น„๊ฐ€ ๋˜์—ˆ๋‹ค๋Š” ๊ฒƒ์„ ๋ณด์žฅํ•˜๊ณ , ์‹ค์ œ๋กœ ๋ฐ์ดํ„ฐ ์ „๋‹ฌ์ด ์‹œ์ž‘๋˜๊ธฐ์ „์— ํ•œ ์ชฝ์ด, ๋‹ค๋ฅธ ์ชฝ์ด ์ค€๋น„๋˜์—ˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค. ์ฆ‰, TCP/IPํ”„๋กœํ† ์ฝœ์„ ์ด์šฉํ•ด์„œ ํ†ต์‹ ์„ ํ•˜๋Š” ์‘์šฉํ”„๋กœ๊ทธ๋žจ์ด ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ•˜๊ธฐ ์ „์— ๋จผ์ € ์ •ํ™•ํ•œ ์ „์†ก์„ ๋ณด์žฅํ•˜๊ธฐ ์œ„ํ•ด ์ƒ๋Œ€๋ฐฉ ์ปดํ“จํ„ฐ์™€ ์‚ฌ์ „์— ์„ธ์…˜์„ ์ˆ˜๋ฆฝํ•˜๋Š” ๊ณผ์ • 1. A(Client) → B(Server): SYN ํ”„๋กœ์„ธ์Šค A๊ฐ€ ์—ฐ๊ฒฐ ์š”์ฒญ ๋ฉ”์‹œ์ง€(SYN, 'synchroni..

[์›น/์ตœ์ ํ™”]Image Lazy Loading

๐Ÿ“Œ Image Lazy Loading์ด๋ž€? ํŽ˜์ด์ง€ ์•ˆ์— ์žˆ๋Š” ์‹ค์ œ ์ด๋ฏธ์ง€๋“ค์ด ํ™”๋ฉด์— ๋ณด์—ฌ์งˆ ํ•„์š”๊ฐ€ ์žˆ์„ ๋•Œ ๋กœ๋”ฉ ํ•  ์ˆ˜ ์žˆ๋„๋ก ์ง€์—ฐ์‹œํ‚ค๋Š” ๊ฒƒ - ๋””๋ฐ”์ด์Šค ๋‚ด ๋ฆฌ์†Œ์Šค ํ™œ์šฉ๋„ ์ฆ๊ฐ€ - ์›น ์„ฑ๋Šฅ ์ตœ์ ํ™” - EX. SPA(Sing Page Application) ๋‚ด์—์„œ ๋ฐ”๋กœ ๋ณด์—ฌ์งˆ ํ•„์š”๊ฐ€ ์—†๋Š” ์ด๋ฏธ์ง€๋ฅผ ์ง€์—ฐ ๋กœ๋”ฉ โœ” ๋ฐฉ์‹ 1. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ด์šฉํ•ด image load๋ฅผ ํŠธ๋ฆฌ๊ฑฐํ•˜๊ธฐ HTML JS document.addEventListener("DOMContentLoaded", function() { var lazyloadImages = document.querySelectorAll("img.lazy"); var lazyloadThrottleTimeout; function lazyload () { if(lazylo..

[๋ฆฌ์•กํŠธ] flux ํŒจํ„ด๊ณผ, ๋ฏธ๋“ค์›จ์–ด ์ข…๋ฅ˜ ๋ฐ ์žฅ๋‹จ์ 

๐Ÿ“Œ ๊ธฐ์กด์˜ mvc ํŒจํ„ด SPAํ˜•ํƒœ๋กœ ๋งŒ๋“ค๋ฉด ๋‹จ ํ•˜๋‚˜์˜ controller๋กœ ์—ฌ๋Ÿฌ๊ฐ€์ง€ view์™€ model์„ ๊ด€๋ฆฌํ•˜๊ฒŒ ๋จ view์—์„œ ์ผ์–ด๋‚œ ์ƒํ˜ธ์ž‘์šฉ์œผ๋กœ ์ธํ•ด ์—ฌ๋Ÿฌ model์ด ๋ณ€๊ฒฝ๋˜๊ฑฐ๋‚˜ ๊ทธ ๋ฐ˜๋Œ€์˜ ๋ฌธ์ œ๋„ ์žˆ์—ˆ์„ ๊ฒƒ ๐Ÿ“Œ ํŽ˜์ด์Šค๋ถ์€ ์ด๋Ÿฌํ•œ ์ƒํ™ฉ์„ ์ค„์ด๊ณ ์ž Flux ํŒจํ„ด์„ ๋งŒ๋“ค์–ด๋ƒ„ flux ํŒจํ„ด์˜ ํ‚ค์›Œ๋“œ๋Š” ๋‹จ๋ฐฉํ–ฅ ๋ฐ์ดํ„ฐ ํ๋ฆ„์ด๋‹ค ๊ธฐ๋ณธํ˜• action์ด ๋ฐœ์ƒํ•˜๋ฉด dispatcher์—์„œ ์ด๋ฅผ ๋ฐ›์•„์™€ ํ•ด์„ํ•œ ํ›„ store์— ์ €์žฅ๋œ ์ •๋ณด์— ๋ณ€๊ฒฝ์„ ๊ฐ€ํ•˜๊ณ  ๊ทธ ๊ฒฐ๊ณผ๊ฐ€ view๋กœ ์ „๋‹ฌ๋จ ๋ฐœ์ „ํ˜• ๋ชจ๋ฐ”์ผ์—์„œ ํ„ฐ์น˜๋ฅผ ํ•˜๋Š” ๊ฒƒ์ฒ˜๋Ÿผ, ์›น์—์„œ๋„ ์‚ฌ์šฉ์ž๊ฐ€ View๋ฅผ ํ†ตํ•ด์„œ ํด๋ฆญ ๊ฐ™์€ ์•ก์…˜์„ ๋ฐœ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค. action์ด ๋ฐœ์ƒํ•˜๋ฉด dispatcher ํ†ตํ•ด ๋‹จ๋ฐฉํ–ฅ์œผ๋กœ ๋ฐ์ดํ„ฐ๊ฐ€ ํ๋ฆ„ ๐Ÿ“Œ ๋‹จ๊ณ„๋ณ„ ์„ค๋ช… Action Action์€ ์ผ์ข…์˜ Ac..

WS vs WAS

์›น์„œ๋ฒ„์™€ ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„œ๋ฒ„์˜ ์ฐจ์ด ๐Ÿ“Œ 1. WS vs WAS ์›น ์„œ๋ฒ„์™€ WAS์˜ ์ฐจ์ด๋Š” ์–ด๋–ค ํƒ€์ž…์˜ ์ปจํ…์ธ ๋ฅผ ์ œ๊ณตํ•˜๋Š๋ƒ์— ์žˆ๋‹ค ์›น์„œ๋ฒ„(Web Server)๋Š” ์ •์ ์ธ ์ปจํ…์ธ  (html,css, js)๋ฅผ ์ œ๊ณตํ•˜๋Š” ์„œ๋ฒ„์ด๋‹ค. ex) Apache, Nginx ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„œ๋ฒ„(WAS)๋Š” DB์กฐํšŒ๋‚˜, ์–ด๋– ํ•œ ๋กœ์ง์„ ์ฒ˜๋ฆฌํ•ด์•„ ํ•˜๋Š” ๋™์ ์ธ ์ปจํ…์ธ ๋ฅผ ์ œ๊ณตํ•˜๋Š” ์„œ๋ฒ„์ด๋‹ค. ex) Tomcat, Jeus ์›น ์„œ๋ฒ„์™€ WAS๋Š” ๊ฐ๊ฐ ๋…๋ฆฝ์ ์œผ๋กœ ์กด์žฌํ•  ์ˆ˜ ์žˆ์Œ ๋Œ€๋ถ€๋ถ„์˜ WAS๋Š” ์ •์ ์ธ ์ปจํ…์ธ ๋„ ์ œ๊ณตํ•ด์ฃผ๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์—, ์›น ์„œ๋ฒ„ ์—†์ด WAS๋กœ๋งŒ ์กด์žฌํ•  ์ˆ˜ ์žˆ์Œ (์›น ์„œ๋ฒ„ < WAS ํฌํ•จ ๊ฐœ๋…) ๐Ÿ“Œ 2. ๊ทธ๋Ÿผ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  WS๋ฅผ WAS ์•ž๋‹จ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ  a. WAS๊ฐ€ ํ•ด์•ผ ํ• ์ผ์˜ ๋ถ€๋‹ด์„ ์ค„์ด๊ธฐ ์œ„ํ•ด์„œ WAS ์•ž์— ์›น์„œ๋ฒ„..