Distinguish underfined, null, and Nan
First, let's look at the running result of the following statement:
1: VaRA;
2:Alert ();// Display "undefined"
3:Alert (TypeofA );// Display "undefined"
4:Alert (B); // display"Undefined"
The value
1. Type analysis:JS data types have undefined,boolean,number,string,object, such as 5, the first 4 are the original type, the 5th is the reference type.CodeCode highlighting produced by Actipro Codehighlighter (freeware)
Nan, meaning not a nnmber. The main purpose of introducing this numeric type variable in Javascript is to control the situation where "a number is returned but no number is returned. For example, if a number is divided by 0, errors may occur in many
1. Type analysis :The data type in JS has 5 kinds of undefined,boolean,number,string,object, the first 4 is the original type, and the 5th type is reference.Code
Copy Code code as follows:
var A1;
var a2 = true;
var a3 = 1;
var
differentiate between Underfined,null and Nan Let's look at the result of the following statement: 1: var A; 2: //Show "undefined" 3: alert (typeof//Show "undefined" ) 4: alert (b); Show "Undefined" The values and types of a above are ' underfined '
1. Type Analysis:The data types in js include undefined, boolean, number, string, and object. The first four are original data types and the second are reference data types.Code
Copy codeThe Code is as follows: var a1;
Var a2 = true;
Var a3 = 1;
Var
1. Type Analysis:The data types in js include undefined, boolean, number, string, and object. The first four are original data types and the second are reference data types.CodeCopy codeThe Code is as follows:Var a1;Var a2 = true;Var a3 = 1;Var a4 =
Before introducing the differences between the three JS data types, let's take a look at the JS data types. In a language such as Java and C, before using a variable, you must first define the variable and specify its data type, which is an integer,
js judging undefined typeToday you use ShowModalDialog to open a page and return a value. When opening a page click the Close button or direct point on the browser close then the return value is undefinedso smart to judgevar
JS determines the undefined type
Today, when showmodaldialog is used to open the page and return values. When you click the close button on the page or click Close in the browser, the returned value is undefined.Therefore, smart judgmentVaR revalue
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.