One,JavaScript data type:undefined,null,boolean,number,string,ObjectFive add a type of complexity.pay attention to case, distinguish big not write
Functions: function
typeof The return data type is not NULL, but has a function. such as typeof (NULL) returns an object
1.1 Special and:
typeof (NaN) typeof (Infinity) = number
typeof (undefined) =>undefined
1.2 Logic:
Undefined,null, "", 0 = False but only undefined==null true other return False
two,= = && = =
= =, when the value types on both sides are different, type conversion is performed before comparison.
= = =, do not type conversion, different types of certain range.
"123" ==123, "0123" ==123 =>true; "0123" ==0123 = false; The reason is that 0123 is converted into 10 binary as 8 binary. So pay attention to these details
Three,Note that JavaScript is<script>segment execution, function pre-compilation。 What does that mean, on the example
<script>
functionA () {alert (' 1 ')};a ()
function A () {alert (' 2 ')};a ();
</script>
All two outputs are 2.
<script>
function A () {alert (' 1 ')};a ()
</script>
<script>
function A () {alert (' 2 ')};a ();
</script>
The output is 1, 2, respectively.
Proficient in JS notes