Javascript Undefined, which you may not know

Source: Internet
Author: User

Java code
Var abc;
 
Alert (abc); // output undefined directly to indicate that the variable is not initialized.
Alert (abc = undefined) // Output true here
 
Var jeo = undefined;
Alert (jeo); // undefined is also output here, which indicates that if undefined is initialized to the variable, the undefined effect is the same as the undefined effect.
Alert (jeo = undefined); // Output true here to prove that the uninitialized value of the variable is undefined again
Alert (typeof abc); // here the output is also undefined
 
Var undefined = "What is output here? ";
Alert (undefined); // output here: "What is output here? "It should be easy to understand here
Alert (undefined = undefined); // but what is output below, I guess many of you have not tried it. Is it surprising that true is output here? Here is what we should pay attention to most.
 
// Take a look at the following
Alert (job); // print this directly. I guess everyone knows that the 'job undefined 'error will be reported.
Alert (typeof job); // the output of undefined is shown here. Through the comparison above, we can easily conclude that the operation of unspecified variables except typeof is not allowed.

Author: "LoveBeyond"
 

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: info-contact@alibabacloud.com 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.