Null,undefined,true,false, as well as = = and = =

Source: Internet
Author: User

undefined is undefined, and the value is undefinedwhen the variable is not assigned a value. "Missing value", that is, there should be a value here, but there is no definition.

underclared is a contaminated name, access to a variable that is not declared, throws an exception, and terminates execution.

null is an empty object reference. "No object", that is, there should be no value at all

undefined and null The in the IF statement is automatically converted to false , and the equality operator even reports the two equals directly. typeof undefined returns undefined, and typeof null  always returns  object (< Span style= "Background-color: #ffc9e4;" >typeof has six possibilities: "number ", " string "," boolean "," object "," "," undefined ")

false = = undefined; // false false null; // false null = = undefined; // true

(Window.foo | | (Window.foo = "Bar");

Question: What is the value of Window.foo? The "| |" Operation 5-15 essay has been recorded. If Window.foo is false, then window.foo= ' Bar ', where Window.foo equals global variable, but undefined, for undefined, actual | | Before the If judgment, undefined automatically to false;

Null,undefined,true,false, as well as = = and = =

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.