답은 true 입니다. 이상하지 않나요?
즉 ""이 형변환이 되어 0으로 되서 true로 되었습니다.
또 alert("" === 0) ; 이면 false가 됩니다.
그리고 ""이 형변환해서 0이 된 이유는 아래와 같습니다.
자바스크립트에서 null과 undefined의 차이점을 알아야 하는데요
In JavaScript, undefined means a variable has been declared but has not yet been assigned a value, such as:
null is an assignment value. It can be assigned to a variable as a representation of no value:
From the preceding examples, it is clear that undefined and null are two distinct types: undefined is a type itself (undefined) while null is an object.
Unassigned variables are initialized by JavaScript with a default value of undefined.
JavaScript never sets a value to null. That must be done programmatically.
As such, null can be a useful debugging tool. If a variable is null, it was set in the program, not by JavaScript.
null values are evaluated as follows when used in these contexts:
undefined values are evaluated as follows when used in these contexts:
=============================================================================
----------------------------------------------------------------
달팽이
이것도 궁금한데요.
GoodBug