본문 바로가기

프로그래밍/Javascript

forEach를 중간에 멈출 수는 없다 Haxbotron의 버그를 고치다가 미처 몰랐던 사실을 알게 되었습니다. (그동안 마치 정상적으로 작동하는 것처럼 보였으나, 세부 동작이 바뀌면서 버그가 튀어나왔습니다.) forEach로 반복을 하는 경우 중간에 return; 과 같은 방식으로 멈출 수 없습니다. 예외를 던지지 않고는 forEach()를 중간에 멈출 수 없습니다. 중간에 멈춰야 한다면 forEach()가 적절한 방법이 아닐지도 모릅니다. 다음 방법으로는 조기에 반복을 종료할 수 있습니다. 간단한 for 반복문 for...of, for...in 반복문 Array.prototype.every() Array.prototype.some() Array.prototype.find() Array.prototype.findIndex() 다른 배열 메서..
크롬 익스텐션 개발 참고용 자료 크롬 익스텐션과 관련된 글들을 모아봤습니다. https://crxextractor.com/ Get .CRX Chrome Extension file, it's source code and download .CRX to your computer. Turn any Chrome extension into white box. Learn from code, debug and pentest it! Hey, stranger! 🌻 Take a look at the special page Just download chrome extension!. This article uncovers a number of extremely useful Chrome Extensions to download. There is crxextra..
Node.js에서 로그 기록하기 Node.js에서 로깅 시스템을 구현할 때 참고할만한 좋은 자료가 있어 링크합니다. https://velog.io/@ash/Node.js-%EC%84%9C%EB%B2%84%EC%97%90-logging-%EB%9D%BC%EC%9D%B4%EB%B8%8C%EB%9F%AC%EB%A6%AC-winston-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0 [Node.js] Logging 라이브러리 winston 적용하기 Node.js 서버에 winston으로 로그 남기기 velog.io 로거를 달아 두어야 쌓여 있는 로그를 보고 여러 문제점을 추적할 수 있으니 유용합니다.
우분투(데비안) cli 환경에서 puppeteer 사용하기 chromium을 작동시키기 위한 라이브러리가 없는 경우가 있습니다. 에러가 난다면 다음과 같은 명령어를 사용하여 설치하면 됩니다. sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 l ibglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libx..
타입스크립트 제네릭을 이용한 ArrayList 연습 class ArrayList { private arrayList: (T | number)[] = []; add(indexOrValue: T | number, value ? : T) { if (value !== undefined) { //타입가드 if (typeof indexOrValue === "number") { this.arrayList.splice(indexOrValue, 0, value); } } else { this.arrayList.push(indexOrValue); } } remove(index: number) { this.arrayList.splice(index, 1); } addAll(elements: T[]) { this.arrayList = [...this.arrayList..
Office UI Fabric Office UI FabricThe official front-end framework for building experiences that fit seamlessly into Office and Office 365. https://developer.microsoft.com/en-us/fabric