javascript
-
[Naver D2] 고급 타입스크립트 세션 정리Study/개발 2025. 2. 25. 23:41
권세규님의 네이버 엔지니어링 데이 세션 infer, never만 보면 두려워지는 당신을 위한 고급 TypeScript를 보았다.이 세션을 통해 아래 개념들을 더 명확히 익힐 수 있었다.타입의 대소 비교타입의 종류제네릭 타입 검사또한 아래 과정들을 시각적으로, 단계별로 보여준다.타입스크립트의 타입 검사가 이뤄지는 과정실제 라이브러리 코드에서 타입을 개발하는 과정1시간 12분으로 짧지 않지만 내용이 밀도 있고, 발표자료가 준비가 잘 되어 있기에,타입스크립트를 잘 사용하고 싶다면 꼭 한번 보는 것을 추천한다.infer, never만 보면 두려워지는 당신을 위한 고급 TypeScript이를 아래에 간단히 정리해보았다. (많은 내용 생략) 타입의 대소 비교타입 A와 B의 대소는 서브타입 관계에 따라 달라진다.서브..
-
JS 글자 수 세기 문제Study/개발 2025. 2. 18. 23:16
글자 수 문제JS에서 글자 수를 validation을 하는 경우 보통 length를 사용한다.const MAX_LENGTH = 10;const validate = (value: string) => value.length 하지만, 아래 경우는 어떨까?validate('정답을 맞춰보세요😀');띄어쓰기 포함 10글자이지만, false를 출력하는것을 볼 수 있다.'정답을 맞춰보세요😀'.length; // 11emoji가 길이 2로 계산되기 때문이다.해결책[...'정답을 맞춰보세요😀'].length; // 10위와 같이 spread 연산자를 사용하면 결과가 10으로 정상적으로 나오는 것을 알 수 있다.원인문자열은 인덱싱, 길이연산 등에서 기본적으로 UTF-16 코드 유닛 기반으로 동작한다.'정답을 맞춰보세요..
-
Regular Expression 종류, 동작 방식, 성능Study/개발 2024. 3. 23. 21:04
개발을 하다보면 Regular Expression을 사용할 일이 종종 생긴다. 패턴 매칭을 통해 String을 검증하기도 하고, 특정 패턴의 String을 검색하는 데에도 사용한다. 하지만 따로 공부를 하지 않다보니 매번 원하는 식을 찾는데에 시간이 걸렸다. 또한 내가 쓰는 패턴이 정확히 어떤 동작을 하는 것인지에 대한 이해도 부족했다. 그래서 정규식의 종류, 작동방식, 성능에 대해 알아보기로 했다. 한 번에 다 외우기보단 정리를 해두고 자주 보면서 익히면 생산성을 향상시켜줄 수 있을 것이다. 종류 1. Anchor 시작점과 끝점을 나타낸다. ^: 시작점 $: 끝점 \b: Word boundary; 문자(\w)와 문자가 아닌 것(\W)의 경계를 나타낸다. 2. Quantifier 원하는 패턴이 몇 번이나..
-
[75 LeetCode] 47 - Reorder ListStudy/Leetcode 2023. 6. 10. 21:41
[75 LeetCode]는 코딩테스트 연습을 위해 한 페이스북 개발자가 추천하는 75가지 알고리즘 문제를 풀어보는 시리즈이다. 블라인드 원문: https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-75-LeetCode-Questions-to-Save-Your-Time-OaM1orEU 문제 링크: https://leetcode.com/problems/reorder-list/description/ Reorder List - LeetCode Can you solve this real interview question? Reorder List - You are given the head of a singly linked-list. The list..
-
[75 LeetCode] 46 - Remove Nth Node From End of ListStudy/Leetcode 2023. 6. 10. 21:16
[75 LeetCode]는 코딩테스트 연습을 위해 한 페이스북 개발자가 추천하는 75가지 알고리즘 문제를 풀어보는 시리즈이다. 블라인드 원문: https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-75-LeetCode-Questions-to-Save-Your-Time-OaM1orEU 문제 링크: https://leetcode.com/problems/remove-nth-node-from-end-of-list/ Remove Nth Node From End of List - LeetCode Can you solve this real interview question? Remove Nth Node From End of List - Given th..
-
[75 LeetCode] 45 - Longest Consecutive SequenceStudy/Leetcode 2023. 6. 10. 20:54
[75 LeetCode]는 코딩테스트 연습을 위해 한 페이스북 개발자가 추천하는 75가지 알고리즘 문제를 풀어보는 시리즈이다. 블라인드 원문: https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-75-LeetCode-Questions-to-Save-Your-Time-OaM1orEU 문제 링크: https://leetcode.com/problems/longest-consecutive-sequence/ Longest Consecutive Sequence - LeetCode Can you solve this real interview question? Longest Consecutive Sequence - Given an unsorted ar..
-
[75 LeetCode] 44 - Jump GameStudy/Leetcode 2023. 6. 10. 19:04
[75 LeetCode]는 코딩테스트 연습을 위해 한 페이스북 개발자가 추천하는 75가지 알고리즘 문제를 풀어보는 시리즈이다. 블라인드 원문: https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-75-LeetCode-Questions-to-Save-Your-Time-OaM1orEU 문제 링크: https://leetcode.com/problems/jump-game/ Jump Game - LeetCode Can you solve this real interview question? Jump Game - You are given an integer array nums. You are initially positioned at the arra..
-
[75 LeetCode] 43 - Unique PathStudy/Leetcode 2023. 5. 30. 22:46
[75 LeetCode]는 코딩테스트 연습을 위해 한 페이스북 개발자가 추천하는 75가지 알고리즘 문제를 풀어보는 시리즈이다. 블라인드 원문: https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-75-LeetCode-Questions-to-Save-Your-Time-OaM1orEU 문제 링크: https://leetcode.com/problems/unique-paths/description/ Unique Paths - LeetCode Can you solve this real interview question? Unique Paths - There is a robot on an m x n grid. The robot is initiall..