The journey to becoming a developer

My future is created by what I do today, not tomorrow.

What I learned/CodeSquad Log

CodeSquad Day 49 : Front-end Week 5

Millie 2022. 3. 18. 01:07

 

CodeSquad๐Ÿ”นDay 49

Class by Crong

์˜ค์ „ 10์‹œ ๋ฐ˜๋ถ€ํ„ฐ ์˜คํ›„ 1์‹œ์ฏค๊นŒ์ง€๋Š” ํฌ๋กฑ์˜ ์ˆ˜์—…์ด ์žˆ์—ˆ๋‹ค. 1๋ถ€๋Š” ์ฝ”๋“œ๋ฆฌ๋ทฐ, 2๋ถ€๋Š” ํ”„๋กœํ† ํƒ€์ž…์œผ๋กœ ๋‚˜๋ˆ ์กŒ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ์ฒซ ๋ฆฌ๋ทฐ๋กœ ๋‚ด ์ฝ”๋“œ๊ฐ€ ์„ ํƒ๋˜์—ˆ๋‹ค! ์ด๋Ÿฐ ๊ฒฝ์šฐ๊ฐ€ ์ฒ˜์Œ์ด๊ธฐ๋„ ํ•˜๊ณ , ์‚ฌ์‹ค SASS ์œ„์ฃผ๋กœ ํ•˜๊ณ  JS๋Š” ์ž„์‹œ๋กœ ๋น ๋ฅด๊ฒŒ ๊ตฌํ˜„๋งŒ ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ๊ตฌ์กฐํ™”๋„ ์•ˆ ๋˜์–ด ์žˆ์–ด์„œ ์ข€ ๋‹นํ™ฉ์„ ํ–ˆ๋‹ค. ๋ฆฌ๋ทฐ๋Š” SASS๋Š” ํ•˜์ง€ ์•Š๊ณ  JS๋งŒ ํ•ด์ฃผ์…จ๊ธฐ ๋•Œ๋ฌธ์— ๋” ๊ทธ๋žฌ๋‹ค. ์•ž์œผ๋กœ๋Š” JS๋ฅผ ์ž„์‹œ์ ์œผ๋กœ ๊ตฌํ˜„ํ•œ ๊ฒƒ์€ PR ๋ณด๋‚ด์ง€ ๋ง์•„์•ผ๊ฒ ๋‹ค๋Š” ๊ฒƒ, ๊ทธ๋ฆฌ๊ณ  ์›ฌ๋งŒํ•˜๋ฉด ๊ทธ๋ž˜๋„ ์–ด๋Š์ •๋„ ์„ค๊ณ„๋Š” ์‹œ์ž‘ํ•˜๊ณ  ๊ตฌํ˜„์„ ํ•ด๋‚˜๊ฐ€์•ผ ๊ฒ ๋‹ค๋Š” ๊ฒƒ์„ ๊นจ๋‹ฌ์•˜๋‹ค.

2๋ถ€๋Š” ํ”„๋กœํ† ํƒ€์ž…์— ๋Œ€ํ•œ ๊ฐ•์˜์˜€๋Š”๋ฐ ์ •๋ง ์ฃผ๋ง์— ๊ฐ์„ ์žก๊ณ  ์ œ๋Œ€๋กœ ๊ณต๋ถ€ํ•ด์•ผ๊ฒ ๋‹ค๋Š” ์ƒ๊ฐ์„ ํ–ˆ๋‹ค.

 

Mission

์ˆ˜์—…์„ ๋“ฃ๊ณ  ๋„ˆ๋ฌด ํ”ผ๊ณคํ•ด์„œ ์ ์‹ฌ๋„ ๋จน์ง€ ์•Š๊ณ  ์ž ๋“ค์—ˆ๋‹ค๊ฐ€ ๋ˆˆ์„ ๋œจ๋‹ˆ ๋ฒŒ์จ 2์‹œ 20๋ถ„์ฏค์ด์—ˆ๋‹ค. 5์‹œ๊ฐ€ ๊ทธ๋ฃน ๋ฆฌ๋ทฐ์—ฌ์„œ ๋ถ€๋žด๋ถ€๋žด ์ปดํ“จํ„ฐ๋ฅผ ์ผœ๊ณ  ๋ฏธ์…˜์„ ์‹œ์ž‘ํ–ˆ๋‹ค.

์ด๋ฒˆ์—๋Š” ๊ธฐ๋Šฅ ๊ตฌํ˜„๋ณด๋‹ค๋Š” ๊ทธ์ „์— index.js ํŒŒ์ผ์— ๋งˆ๊ตฌ ์ž‘์„ฑํ•œ ๋กœ์ง๋“ค์„ ์ปดํฌ๋„ŒํŠธ๋กœ ๋ถ„๋ฆฌํ•˜๋Š” ๋ฆฌํŒฉํ† ๋ง์„ ํ–ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ํ‚ค์›Œ๋“œ๋ฅผ ๊ฒ€์ƒ‰ํ•  ๋•Œ ๊ธฐ์กด์—๋Š” ํด๋ผ์ด์–ธํŠธ ์ชฝ์—์„œ ์ฒ˜๋ฆฌํ•˜๋˜ ๊ฒƒ์„ express์—์„œ query๋ฅผ ์ด์šฉํ•ด์„œ ๊ฒ€์ƒ‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ–ˆ๋‹ค.

์ฝ”๋“œ์Šค์ฟผ๋“œ ์ •๊ทœ ์‹œ๊ฐ„์ด ๋๋‚˜๊ณ  ๋‚˜์„œ๋Š” ์•„๋ž˜ ๋ธ”๋กœ๊ทธ ๊ธ€์„ ์ฐธ๊ณ ํ•ด์„œ ๋‚ด ์ฝ”๋“œ์— ์ ์šฉํ•ด ๋ณด์•˜๋‹ค. ์•„์ง state ๋ถ€๋ถ„์€ ์ ์šฉํ•˜์ง€ ๋ชปํ•ด์„œ ๋‚ด์ผ ์‹œ๋„ํ•  ์˜ˆ์ •์ด๋‹ค.

 

 

Vanilla Javascript๋กœ ์›น ์ปดํฌ๋„ŒํŠธ ๋งŒ๋“ค๊ธฐ | ๊ฐœ๋ฐœ์ž ํ™ฉ์ค€์ผ

Vanilla Javascript๋กœ ์›น ์ปดํฌ๋„ŒํŠธ ๋งŒ๋“ค๊ธฐ 9์›”์— ๋„ฅ์ŠคํŠธ ์Šคํ… (opens new window)์—์„œ ์ง„ํ–‰ํ•˜๋Š” ๋ธ”๋ž™์ปคํ”ผ ์Šคํ„ฐ๋”” (opens new window)์— ์ฐธ์—ฌํ–ˆ๋‹ค. ์ด ํฌ์ŠคํŠธ๋Š” ์Šคํ„ฐ๋”” ๊ธฐ๊ฐ„๋™์•ˆ ๊ณ„์† ๊ณ ๋ฏผํ•˜๋ฉฐ ๋งŒ๋“ค์—ˆ๋˜ ์ปดํฌ๋„ŒํŠธ

junilhwang.github.io

 

Algorithm

์˜ค๋Š˜์˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ๋„์ „ํ–ˆ๋‹ค๊ฐ€ ๋ชป ํ’€๊ณ , ๋ฏธ๋ฆฌ ๋‹ค์Œ ์ฃผ ์›”์š”์ผ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ํ’€์—ˆ๋‹ค. ๋‚ด์ผ์€ ๊ทธ๋ž˜์„œ 2๊ฐœ๋ฅผ ํ’€์–ด์•ผ ํ•œ๋‹ค.

 

First Unique Character in a String - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com


๋ฐค์— ๊ฒŒ๋”ํƒ€์šด์— ์žˆ์—ˆ๋Š”๋ฐ, ์ง€๋ฏธ๊ฐ€ Event Bubbling์„ ํ™œ์šฉํ•˜๋Š” ๊ฒƒ์— ๋Œ€ํ•ด์„œ ์งˆ๋ฌธ์„ ํ•ด์™”๋‹ค. ๋„๋‹ˆ์™€ ํ•จ๊ป˜ ๋ฌธ์ œ์ƒํ™ฉ์„ ๋ณด์•˜๋‹ค. ์ถ”์ฒœ ๊ฒ€์ƒ‰์–ด layer๋Š” input ๋ถ€๋ถ„์„ ์ œ์™ธํ•˜๊ณ  ๋‹ค๋ฅธ ๋ถ€๋ถ„์ด ํด๋ฆญ๋˜๋ฉด ์—†์–ด์ ธ์•ผ ํ•œ๋‹ค. ์ด ๋•Œ document์— click ์ด๋ฒคํŠธ๋ฅผ ๊ฑธ์–ด์„œ ํ•ด๊ฒฐํ•˜๋Š”๋ฐ, closest๋ฅผ ํ™œ์šฉํ•ด์„œ ํด๋ฆญ๋œ target์˜ ์กฐ์ƒ์ด ๋งŒ์•ฝ layer๊ฐ€ ์•„๋‹ ๊ฒฝ์šฐ, ์ฆ‰ layer ๋ฐ”๊นฅ์ด ํด๋ฆญ๋˜์—ˆ์„ ๊ฒฝ์šฐ layer๋ฅผ ์—†์•  ์ค€๋‹ค. closest๋ฅผ ํ™œ์šฉํ•˜๋Š” ๊ฒƒ์„ ์ œ์•ˆํ–ˆ๊ณ , ์ฝ”๋“œ๊ฐ€ ๊น”๋”ํ•ด์งˆ ์ˆ˜ ์žˆ์—ˆ๋‹ค.

'What I learned > CodeSquad Log' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

CodeSquad Day 52 : Front-end Week 6  (0) 2022.03.23
CodeSquad Day 51 : Front-end Week 6  (0) 2022.03.22
CodeSquad Day 48 : Front-end Week 5  (0) 2022.03.16
CodeSquad Day 47 : Front-end Week 5  (0) 2022.03.16
CodeSquad Day 46 : Front-end Week 5  (0) 2022.03.15