Proficient in JS notes

Source: Internet
Author: User

One,JavaScript data type:undefined,null,boolean,number,string,ObjectFive add a type of 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
functionA () {alert (' 1 ')};a ()
function A () {alert (' 2 ')};a ();
All two outputs are 2.
function A () {alert (' 1 ')};a ()
function A () {alert (' 2 ')};a ();
The output is 1, 2, respectively.

Proficient in JS notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.