| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 29 | 30 | 31 |
Tags
- 우아한테코톡
- 햇소
- JavaScript
- next.js
- ES6+
- 함수
- CSS
- es6
- hooks
- API
- ChatGPT
- react
- AI
- git
- 최적화
- dev
- github
- 변수
- 선택자
- array
- html5
- ES5+
- gitCLI
- hatso
- learn next.js
- Python
- JS
- object
- DOM
- This
Archives
- Today
- Total
목록nullish (1)
codinghatso
nullish 병합 연산자(nullish coalescing operator) ??를 사용하면 짧은 문법으로 여러 피연산자 중 그 값이 ‘확정되어있는’ 변수를 찾을 수 있습니다. a ?? b의 평가 결과는 다음과 같습니다. a가 null도 아니고 undefined도 아니면 a 그 외의 경우는 b nullish 병합 연산자 ??없이 x = a ?? b와 동일한 동작을 하는 코드를 작성하면 다음과 같습니다. x = (a !== null && a !== undefined) ? a : b; 예시 let firstName = null; let lastName = null; let nickName = "바이올렛"; // null이나 undefined가 아닌 첫 번째 피연산자 alert(firstName ?? las..
WEB/JavaScript Diary
2022. 3. 8. 19:05