본문 바로가기

What I Read19

JavaScript Tips to Help You Build Better Web Development Projects (1) 원문 1. Use Console.table() to Display Arrays and Objects in the Console 1. 콘솔 창에서 배열과 객체를 볼 때, console.table() 사용하기 2. Use Template Interpolation to Render Strings Instead of the Assignment Operator 2. 문자를 렌더링할 때, 할당 연산자보다는 템플릿 리터럴을 사용하기 3. Convert Strings to Numbers with Unary Plus and Number Constructor 3. 문자를 숫자로 바꿀 때 단항 연산자 + 와 Number 생성자 사용하기 4. You Don't Need to Declare Every Variable w.. 2023. 11. 10.
Airbnb JavaScript 스타일 가이드 - 3. 객체 Objects 3-1. 객체를 생성할 때는 리터럴 문법 사용하기 eslint : no-new-object 3-2. 동적 속성을 갖는 객체를 생성할 때는 속성 계산명을 사용하기 - 객체의 모든 속성을 한 곳에서 정의하기 위해 function getKey(k) { return `a key named ${k}`; } // bad const obj = { id: 5, name: 'San Francisco', }; obj[getKey('enabled')] = true; // good const obj = { id: 5, name: 'San Francisco', [getKey('enabled')]: true, }; 3-3 , 3-4.메서드 단축구문 사용하기 eslint : object-shorthand // bad const a.. 2023. 11. 3.
[ Medium ] I Bet You Don't Use These JavaScript Tricks and Practices 1. Using FlatMap flatMap은 중간에 배열을 만들지 않고 한번에 하지만, filter().map()은 중간에 배열(intermediate array)을 만든다. 2023.10.31 - [FrontEnd/JavaScript] - [ JavaScript ] flatMap() 2. Order of Array Methods const numbers = [9, 3, 6, 4, 8, 1, 2, 5, 7]; //before numbers .sort((a, b) => a - b) .filter((n) => n % 2 !== 0) .map((n) => n ** 3); //after numbers .filter((n) => n % 2 !== 0) .sort((a, b) => a - b) .map((n) =.. 2023. 10. 31.
[ 번역 ] this in JavaScript and TypeScript 보호되어 있는 글 입니다. 2023. 10. 31.
[ 번역 ] Symbol in JavaScript and TypeScript 보호되어 있는 글 입니다. 2023. 10. 30.
[ 번역 ] Boolean in JavaScript and TypeScript You will learn: - Union types - null & undefined as types - Value types (or literal types) boolean은 자바스크립트에서 재밌는 원시 데이터 타입입니다. 타입스크립트에서, boolean은 총 4 가지의 값을 가능하게 합니다. 잠깐만, 4개 라구요? Boolean in JavaScript boolean은 true 와 false의 값을 가질 수 있습니다. 다른 타입으로부터의 값은 truthy 이거나 falsy 일 수 있습니다, undefined 또는 null 같이요. falsy로 판단되는 값들 중에 undefined,null,false 말고도 ""(빈 문자열), -0, 0, NaN 이 있습니다. 어떤 값에서 불린 값을 가져오려면, Bo.. 2023. 10. 29.