FE๋ฅผ ํ–ฅํ•ดโ†—โ†—

function solution(my_string) { return eval(my_string); } function solution(my_string) { let result = 0; my_string = my_string.split(" ").filter((v) => v !== "+"); for (let i = 0; i < my_string.length; i++) { if (my_string[i] === "-") { result -= parseInt(my_string[i + 1] * 2); } else { result += parseInt(my_string[i]); } } return result; } /* (ํ’€์ด) 1. eval ๋ฉ”์„œ๋“œ๋ฅผ ์ด์šฉํ•ด ๋ฌธ์ž์—ด์„ ๊ณ„์‚ฐ 2. ๊ณต๋ฐฑ์œผ๋กœ ์š”์†Œ๋ฅผ ๋‚˜๋ˆ ์ฃผ๊ณ  filter..
function setSortAndFliter(arr, arr2) { return arr.sort((a, b) => a - b).filter((v) => !arr2.includes(v)); } function solution(n, lost, reserve) { const noPeClothesStudent = setSortAndFliter(lost, reserve); const extraPeClothesStudent = setSortAndFliter(reserve, lost); for (const el of noPeClothesStudent) { const extraUniformidx = extraPeClothesStudent.findIndex( (value) => value === el - 1 || va..
ยท GitHub
ํšŒ๊ณ  ์กฐ ์Šคํ„ฐ๋”” ๋ ˆํฌ์—์„œ ํŒ€์›๋ถ„์ด ์‹ค์ˆ˜๋กœ PR์„ ๋จธ์ง€ํ•˜๋Š” ์ƒํ™ฉ์ด ๋ฐœ์ƒ. ํ•ด๊ฒฐ๋ฒ•์„ ๊ตฌ๊ธ€๋งํ•˜๋‹ค ๊ฒฐ๊ตญ ๋‚จ์•„์žˆ๋Š” PR์„ ์ „๋ถ€ ๋จธ์ง€ํ•˜๊ณ  ํŒ€์›๋ชจ๋‘ pull์„ ๋ฐ›์•„ ๋‹ค์‹œ ์‹ฑํฌ๋ฅผ ๋งž์ถฐ์ฃผ์—ˆ๋‹ค. revert๋ฅผ ์ด์šฉํ•˜๋ฉด ํ•ด๋‹น ์ปค๋ฐ‹์„ ๋ฌดํšจ๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹คํ•˜์—ฌ ์ฐพ์•„๋ณด์•˜๊ณ  ์ง์ ‘ ์‹ค์Šตํ•ด๋ณด์ž. ์ผ๋‹จ test1 ๋ธŒ๋žœ์น˜๋ฅผ ๋งŒ๋“ค๊ณ  pr์„ ๋‚ ๋ ค์ฃผ์—ˆ๋‹ค. ์ด์–ด์„œ test2 ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ ํ›„ pr์„ ๋˜‘๊ฐ™์ด ๋‚ ๋ ค์ฃผ๊ณ  test1 PR์„ ๋จธ์ง€ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ๋ณ‘ํ•ฉ ์‹œ์ผœ์ค€๋‹ค. main ๋ธŒ๋žœ์น˜ ์ปค๋ฐ‹๋‚ด์—ญ์„ ๋ณด๋ฉด 3๊ฐœ์˜ ์ปค๋ฐ‹๊ณผ ๋จธ์ง€ ์ปค๋ฐ‹์ด ๋‚จ์•„์žˆ๋‹ค. ๋‚ด๊ฐ€ ๋Œ์•„๊ฐ€๊ณ  ์‹ถ์€ ์‹œ์ ์€ ์ด์Šˆ ์ปค๋ฐ‹ ํ…Œ์ŠคํŠธ #2 ๋ถ€๋ถ„์ด๋‹ค. main ๋ธŒ๋žœ์น˜๋กœ ์ด๋™ ํ›„ ์›๊ฒฉ ์ €์žฅ์†Œ ๋‚ด์šฉ์„ pull๋กœ ๋ฐ›์•„์˜ค๊ณ  git log๋กœ ํ™•์ธํ•ด๋ดค๋‹ค. ์ œ์ผ ์ตœ๊ทผ ์ปค๋ฐ‹์ธ ์ƒ๋‹จ Merge ๋ฅผ ํ™•์ธํ•ด ๋ณด๋ฉด ๋‘๊ฐœ์˜ ํƒœ..
this ๋ž€? this๋ž€ ๊ฐ์ฒด์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์—์„œ ์‚ฌ์šฉํ•˜๋Š” ํ‚ค์›Œ๋“œ์ด๋ฉฐ ์ด๋•Œ this๋Š” ํ•ด๋‹น ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ํด๋ž˜์Šค์˜ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‚˜ํƒ€๋‚ธ๋‹ค. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ์˜ this๋Š” ์กฐ๊ธˆ ๋‹ค๋ฅด๋‹ค. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ this๋Š” ์ž์‹ ์ด ์†ํ•œ ๊ฐ์ฒด ๋˜๋Š” ์ž์‹ ์ด ์ƒ์„ฑํ•  ์ธ์Šคํ„ด์Šค๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋Š” ์ž๊ธฐ ์ฐธ์กฐ ๋ณ€์ˆ˜์ด๋‹ค. this๋ฅผ ํ†ตํ•ด ์ž์‹ ์ด ์†ํ•œ ๊ฐ์ฒด๋‚˜ ์ƒ์„ฑํ•  ์ธ์Šคํ„ด์Šค์˜ ํ”„๋กœํผํ‹ฐ๋‚˜ ๋ฉ”์„œ๋“œ๋ฅผ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ๋‹ค. this์˜ ๋ฐ”์ธ๋”ฉ function sayName() { const name = 'yunCow' console.log(this.name) } sayName(); // ? ์ฝ”๋“œ๋งŒ ๋”ฑ ๋ดค์„๋• console.log์— 'yunCow'๋ฅผ ๋ณด์—ฌ์ค„ ๊ฒƒ์œผ๋กœ ๋ณด์ธ๋‹ค. ํ•˜์ง€๋งŒ ๊ทธ๋ ‡์ง€ ์•Š๋‹ค. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ์˜ this๊ฐ€ ์ฐธ์กฐํ•˜๋Š” ๊ฒƒ์€ ํ•จ์ˆ˜์˜ ํ˜ธ์ถœ ๋ฐฉ์‹์—..
Learned flat๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ด๋ดค๋‹ค! ์ค‘์ฒฉ if๋ฌธ์ด ํ•„์š”ํ•˜๋‹ค ์ƒ๊ฐํ•œ ๋ถ€๋ถ„์„ ์‚ผํ•ญ์—ฐ์‚ฐ์ž๋กœ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ• Liked ๋น„๋ก ๋‚ด๊ฐ€ ์ง์ ‘ ์ƒ๊ฐํ•ด์„œ ๋งŒ๋“  ์žฌ๊ท€ํ•จ์ˆ˜๋Š” ์•„๋‹ˆ์˜€์ง€๋งŒ ๊ทธ๋ž˜๋„ ์กฐํ•ฉ ์•Œ๊ณ ๋ฆฌ์ฆ˜์— ๋Œ€ํ•ด ๋ฐฐ์šฐ๊ณ  ์‚ฌ์šฉํ–ˆ๋‹ค. ์ค„์–ด๋“  ๋ฉ”์„œ๋“œ ๊ตฌ๊ธ€๋ง Lacked const์™€ let ์œ„์น˜ ์ปจ๋ฒค์…˜ ์‹ค์ˆ˜ (const์šฐ์„  ๊ทธ๋ฆฌ๊ณ  let) ์ •๋ฆฌํ•  ๋•Œ ์‚ผํ•ญ์—ฐ์‚ฐ์ž ์ƒ๊ฐ ์•ˆ๋‚˜๋ฉด ์ค‘์ฒฉif๋ฌธ ์“ฐ๋Š” ๋ฒ„๋ฆ‡ ๋ถˆํ•„์š”ํ•œ ์ฝ”๋“œ ๋ฐ˜๋ณต
ํ’€์ด ๐Ÿ™Ž๐Ÿป‍โ™‚๏ธ function solution(participant, completion) { participant.sort(); completion.sort(); for (let i = 0; i
ํ’€์ด1 ๐Ÿ™Ž๐Ÿป‍โ™‚๏ธ //ํ’€์ด 1 function solution(nums) { const numberOfAllCases = getCombinations(nums, 3).map((innerArr) => innerArr.reduce((acc, cur) => acc + cur, 0) ); let result = 0; numberOfAllCases.map((v) => { if (primeNumber(v)) result++; }); return result; } const primeNumber = (x) => { for (let i = 2; i { const result = []; if (arrLength === 1) return arr.map((el) => [el]); arr.map((item, idx, this..
ํ’€์ด ๐Ÿ™Ž๐Ÿป‍โ™‚๏ธ function solution(answer) { const result = []; const personOne = [1, 2, 3, 4, 5]; const personTwo = [2, 1, 2, 3, 2, 4, 2, 5]; const personThree = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]; const answerOne = answer.filter((v, i) => v === personOne[i % 5]).length; const answerTwo = answer.filter((v, i) => v === personTwo[i % 8]).length; const answerThree = answer.filter((v, i) => v === personThree[i..
YunCow
'๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (3 Page)