์ ์ฒด ๊ธ(20)
-
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ชจ์ ์ ๊ฑฐ (JS)
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ชจ์ ์ ๊ฑฐ (JavaScript) ๐ ๋ฌธ์ ์ค๋ช ์์ด์์ a, e, i, o, u ๋ค์ฏ ๊ฐ์ง ์ํ๋ฒณ์ ๋ชจ์์ผ๋ก ๋ถ๋ฅํฉ๋๋ค. ๋ฌธ์์ด my_string์ด ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง ๋ ๋ชจ์์ ์ ๊ฑฐํ ๋ฌธ์์ด์ returnํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. ๐ ์ ํ์ฌํญ my_string์ ์๋ฌธ์์ ๊ณต๋ฐฑ์ผ๋ก ์ด๋ฃจ์ด์ ธ ์์ต๋๋ค. 1 โค my_string์ ๊ธธ์ด โค 1,000 ๐ ์ ์ถ๋ ฅ ์ my_string result "bus" "bs" "nice to meet you" "nc t mt y" ๐ ์ ์ถ๋ ฅ ์ ์ค๋ช ์ ์ถ๋ ฅ ์ #1 "bus"์์ ๋ชจ์ u๋ฅผ ์ ๊ฑฐํ "bs"๋ฅผ returnํฉ๋๋ค. ์ ์ถ๋ ฅ ์ #1 "nice to meet you"์์ ๋ชจ์ i, o, e, u๋ฅผ ๋ชจ๋ ์ ๊ฑฐํ "nc t mt y"..
2022.11.27 -
[ํ๋ก๊ทธ๋๋จธ์ค] ์์์์ ๊ฐ์ (JS)
[ํ๋ก๊ทธ๋๋จธ์ค] ์์์์ ๊ฐ์ JavaScript ๐ ๋ฌธ์ ์ค๋ช ์์์์ด๋ ๋ ๊ฐ์ ์ซ์๋ฅผ ์์๋ฅผ ์ ํ์ฌ ์ง์ง์ด ๋ํ๋ธ ์์ผ๋ก (a, b)๋ก ํ๊ธฐํฉ๋๋ค. ์์ฐ์ n์ด ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง ๋ ๋ ์ซ์์ ๊ณฑ์ด n์ธ ์์ฐ์ ์์์์ ๊ฐ์๋ฅผ returnํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. ๐ ์ ํ์ฌํญ 1 โค n โค 1,000,000 ๐ ์ ์ถ๋ ฅ ์ n result 100 9 20 6 ๐ ์ ์ถ๋ ฅ ์ ์ค๋ช ์ ์ถ๋ ฅ ์ #1 n์ด 20 ์ด๋ฏ๋ก ๊ณฑ์ด 20์ธ ์์์์ (1, 20), (2, 10), (4, 5), (5, 4), (10, 2), (20, 1) ์ด๋ฏ๋ก 6์ returnํฉ๋๋ค. ์ ์ถ๋ ฅ ์ #2 n์ด 100 ์ด๋ฏ๋ก ๊ณฑ์ด 100์ธ ์์์์ (1, 100), (2, 50), (4, 25), (5, 20), (10,..
2022.11.27 -
JavaScript (5) - Array.from() , Array.prototype.reduce() ์ฌ์ฉ๋ฐฉ๋ฒ
Array.from() Array.from() ๋ฉ์๋๋ ์ ์ฌ ๋ฐฐ์ด ๊ฐ์ฒด๋ ๋ฐ๋ณต ๊ฐ๋ฅํ ๊ฐ์ฒด๋ฅผ ์๊ฒ '๋ณต์ฌ'ํด ์๋ก์ด Array ๊ฐ์ฒด๋ฅผ ๋ง๋ ๋ค. console.log(Array.from('soyoung')); // expected output: Array ["s", "o", "y", "o", "u", "n", "g"] console.log(Array.from([1, 2, 3], x => x + x)); // expected output: Array [2, 4, 6] //๋ฐฐ์ด ํ์ฑ๋ฅผ ๊ฐ์ง ๊ฐ์ฒด(arguments)์์ ๋ฐฐ์ด ๋ง๋ค๊ธฐ function f() { return Array.from(arguments); } f(1, 2, 3); // [1, 3, 3] Array.prototype.reduce() ๋ฐฐ์ด์ ..
2022.10.13 -
Mac OS ํฐ๋ฏธ๋์์ Visual Studio Code ๋ฐ๋ก ์คํํ๊ธฐ
Mac OS ํฐ๋ฏธ๋์์ 'code ํ๋ก์ ํธ๋ช ' ์ด๋ 'code.' ์ ์ ๋ ฅํ์ฌ Visual Studio Code ๋ฅผ ๋ฐ๋ก ์คํํ ์ ์๋ค. ๊ทธ๋ฌ๋ ์๋ฌด๋ฐ ์ค์ ์์ด๋ ์์ ์บก์ณ์์ ๋ณด์ด๋ฏ์ด code: command not found ๋ผ๊ณ ์๋ฌ ๋ฌธ๊ตฌ๊ฐ ๋ฌ๋ค. ์ด๋ Mac OS ํฐ๋ฏธ๋์์ code ๋ผ๋ ๋ช ๋ น์ด๋ฅผ ์ฝ์ง ๋ชปํ๊ณ ์๋ ๊ฒ์ด๋ค. ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด์๋ Visual Studio Code ์์ Path ๋ฅผ ๋ฑ๋กํด์ฃผ์ด์ผํ๋ค. Visual Studio Code์์ Path ๋ฑ๋กํ๋ ๋ฒ Visual Studio Code ์ด๊ธฐ Command Palette ์ด๊ฑฐ๋ ๋จ์ถํค Mac : cmd + shift + p ์ ๋ ฅ Shell Command: Install 'code' command in PATH ์ ๋ ฅ Shell ..
2022.09.28 -
React (3) - TypeScript ์ค๋ ํ๋ฃจ ์๋ณด๊ธฐ ํ์ ๋ง๋ค๊ธฐ
React ๋ก '์ค๋ ํ๋ฃจ ์๋ณด๊ธฐ' ํ์ ์ ๋ง๋ค์๋ค. ์๊ฐ์ ์ธ์ ์ด๋, ๋ก์ปฌ์คํ ๋ก์ง์ ์ ์ฅํ ์ ์๋๋ฐ, ๋ก์ปฌ์คํ ๋ก์ง์ ์ ์ฅํ์๋ค. ์ฐ์ localStorage.setItem("PopUpNotShow", ์๊ฐ); ์ผ๋ก ์๊ฐ์ ์ ์ฅ ํ๋ค. ๊ทธ ๋ค์ ์ฌ์ฉ์๊ฐ ์ ์ ํ์์ ๋, localStorage ์ ์ ์ฅ๋ PopUpNotShow์ ๊ฐ์ ธ์จ๋ค. localStorage.getItem("PopUpNotShow"); { const PopUpNotShow: string | null = localStorage.getItem("PopUpNotShow"); //localStorage์ PopUpNotShow ๊ฐ์ ๊ฐ์ ธ์จ๋ค. const currentTime = Math.floor(new Date().getTime()); ..
2022.04.10 -
์น, ์น ๋ฐ์ํ์์๋ ์ ์์ธ๋ฐ ๋ชจ๋ฐ์ผ์์ ์ด๋ฏธ์ง๊ฐ ํ์ ๋์ด ๋ณด์ด๋ ์ด์
css ๋ก background ๋ก ์ด๋ฏธ์ง๋ฅผ ๋ณด์ฌ์ฃผ๋๋ฐ, ์นํ์ด์ง์์๋ ์ ์์ ์ผ๋ก ๋ณด์ด๊ณ ํ์ด์ง ๊ฐ๋ก๋ฅผ ์ค์ฌ๋ ์ด๋ฏธ์ง ์ฌ์ด์ฆ๋ง ์ค์์ ๋ฟ ์ ๋๋ก๋ ๋ฐฉํฅ์ผ๋ก ๋์๋ค. ์น์ ๋ฐฐํฌ ํ ํ ๋ชจ๋ฐ์ผ(ํฐ)์ผ๋ก ํ ์คํธํ์ ๋ ์ด๋ฏธ์ง๋ฐฉํฅ์ด ๋ณ๊ฒฝ๋์๋ค. ์ค์ ๋ก ์ด๋ฏธ์ง๋ฅผ ์ด์ด๋ณด์์ ๋๋ ์ด๋ฏธ์ง ๋ฐฉํฅ์ ์ ๋๋ก ๋์๋ค. ๋ด ์์์ผ๋ก EXIF ์ด๋ฏธ์ง ํ์ ๊ฐ์ ๋ฌธ์ ์ธ ๊ฒ ๊ฐ์๋ค. ์ฐ์ ์ด๋ฏธ์ง๋ฅผ ํฌํ ์ต์์ ํ์ธํด๋ณด๋, ๋ชจ๋ฐ์ผ์์ ๋ณด์๋ ๊ฒ๊ณผ ๊ฐ์ด ํ์ ๋์ด์ ๋ณด์ฌ์ก๋ค. ๋ชจ๋ฐ์ผ์์ ๋ณด์ธ ์ด๋ฏธ์ง๊ฐ ์ง์ง ํ์ ๊ฐ์ด์๋ค. ํฌํ ์ต์ผ๋ก ๋ฐฉํฅ์ ๋ณ๊ฒฝํ ํ ์ ์ฅํ๊ณ ๋ค์ ๋ฐฐํฌํ์ฌ ๋ชจ๋ฐ์ผ๋ก ํ ์คํธํ๋ ์ด๋ฏธ์ง๊ฐ ์ ๋๋ก๋ ๋ฐฉํฅ์ผ๋ก ๋์๋ค. ์ด๋ฏธ์ง๊ฐ ์น, pc ์ ๋ชจ๋ฐ์ผ์์ ๋ค๋ฅธ๋ฐฉํฅ์ผ๋ก ๋ณด์ผ ๊ฒฝ์ฐ exif ๊ฐ์ ํ์ธํด๋ณด๊ฑฐ๋, ํฌํ ์ต์ผ๋ก ์ด๋ฏธ์ง๋ฅผ ์ด์ด๋ณด๋ฉด ํ..
2022.04.09