IT-개발,DB
자바스크립트에서 ==., ===
SB리치퍼슨
2019. 6. 16. 16:07
1. 자바스크립트에서 ==., ===
==는 loose equality할때 사용한다. 또한 ==은 형변환을 수행한다.
형변환 후에 오직 두개의 값 비교만 수행한다는 의미이다.
(Type coercion means that two values are compared only after attempting to convert them into a common type.)
===는 strict equality 할때 사용한다.
타입(type)과 값(value) 모두 비교했을때 같아야 한다.
Falsy Value Comparison(거짓값 비교)
거짓값은 false, 0, "", null, undefined, NaN으로 총 6가지이다.
1. false — boolean false
2. 0 — number zero
3. “” — empty string
4. null
5. undefined
6. NaN — Not A Number
반응형