일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 블로그 서비스 최적화
- 자바스크립트 딥다이브
- 프론트엔드 성능 최적화 가이드
- 새 코드 받아오기
- DOM
- 스코프
- 딥다이브
- version management
- 올림픽 통계 서비스 최적화
- 자바스크립트
- middleware pattern
- 커리어
- 이미지 갤러리 최적화
- js pattern
- 진행기록
- 브라우저의 렌더링 과정
- const
- Babel과 Webpack
- 자바스크립트 패턴
- 프로그래머스
- peerdependencies
- package management
- 제너레이터와 async/await
- unique identifiers
- 학습내용정리
- mixin pattern
- pr review
- 모던 자바스크립트 Deep Dive
- js pattern
- 이벤트
- Today
- Total
목록Web Development/Javascript & Typescript (4)
Dev Blog

const 키워드는 상수(const) 를 선언하기 위해 사용한다. 하지만, 반드시 상수만을 위해 사용하지는 않는다. const 키워드로 선언된 변수에 원시 값을 할당한 경우 값을 변경할 수 있다. 하지만, const 키워드로 선언된 변수에 객체를 할당한 경우 값을 변경할 수 있다. 변경 불가능한 값인 원시 값은 재할당 없이 변경(교체)할 수 있는 방법이 없지만 변경 가능한 값인 객체는 재할당 없이도 직접 변경이 가능하기 때문이다. 이처럼, const 키워드는 재할당을 금지할 뿐 "불변" 을 의미하지는 않는다. 다시 말해, 새로운 값을 재할당하는 것은 불가능하지만 프로퍼티 동적 생성, 삭제, 프로퍼티 값의 변경을 통해 객체를 변경하는 것은 가능하다. 이때 객체가 변경되더라도 변수에 할당된 참조 값은 변경되..
Beautiful Explanation here reference: https://hyunseob.github.io/2017/12/12/typescript-type-inteference-and-type-assertion/
[..] unknown which is the type-safe counterpart of any. Anything is assignable to unknown, but unknown isn't assignable to anything but itself and any without a type assertion or a control flow based narrowing. Likewise, no operations are permitted on an unknown without first asserting or narrowing to a more specific type. let myVar: unknown; let myVar1: unknown = myVar; // No error let myVar2: ..