= = A3); Display "false"
Alert (A2!= A3); Display "true"
Alert (a3 = = A3); Display "false"
Alert (A3!= A3); Display "true"
From the above code it can be concluded that (1) undefined is equal to NULL, (2) Nan is not equal to any value and is not equal to itself.
JavaScript undefined Properties
Definitions and Usage
The undefined property is used to store the undefined value of
Why is the Nan of JavaScript not equal to NanIn js object = = = Object Feels like there's nothing wrong with both of these represent one thingBut what if you tried nan = = = Nan is return false?Because Nan is: not a number is not a numeric abbreviationSince it's not a number
Null means no value, and undefined represents an undeclared variable, or a variable that has been declared but not assigned a value, or an object property that does not exist.The NaN property is a special value that represents a non-numeric value. This property is used to indicate that a value is not a number. You can set the number object to this value to indicate that it is not a numeric value.Null:Indicates that there is no value, but that null its
above code can conclude that: (1) undefined is equal to NULL, (2) Nan is not equal to any value, nor is it equal to itself. JavaScript Undefined PropertiesDefinition and usageThe undefined property is used to store JavaScript undefined values.GrammarUndefinedDescriptionYou cannot use the For/in loop to enumerate the undefined property, nor can you delete it by u
"true"alert (A2 = = A3);//Show "false"alert (a2! = A3);//Show "true"Alert (a3 = = A3);//Show "false"Alert (a3! = A3);//Show "true"From the above code, it can be concluded that (1) undefined is equal to NULL, and (2) Nan is not equal to any value, nor is it equal to itself.JavaScript Undefined PropertiesDefinition and usageThe undefined property is used to store JavaScript undefined values.GrammarUndefinedD
"true"Alert (a2 = a3); // display "false"Alert (a2! = A3); // display "true"Alert (a3 = a3); // display "false"Alert (a3! = A3); // display "true"
From the code above, we can draw a conclusion: (1) undefined is equal to null; (2) NaN is not equal to any value and is not equal to itself.
JavaScript undefined attributes
Definition and usage The undefined attribute is used to store the undefined value of
A Undefined type
Only one value undefined
In the following three cases typeof return type is undefined
1. When the variable is not initialized
2. When the variable is undefined
3. When the function does not have an explicit return value (the function does not return a value is undefined)
Undefined is not equal to undefined value
typeof does not really distinguish whether it is undefined
Look at the following sample code:
var otemp;
Alert (typeof otemp); Outputs "undefined"
Alert (typeof OTEMP2)
literal constant without quotes Nan is a special value that represents not a non-numeric number. Because Nan is always in a relatively unequal situation, in any number, including Nan, it is usually an error condition for a function that indicates that a valid number should be returned.
Note: Use the isNaN () global fu
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 = "Hello ";Var a5 = new Object ();Var a6 = null;Var a7 = NaN;Var a8 = undefined;Alert (typeof a); // display "undefined"Alert (typeof a1); // display "undefined"Alert (typeof a2); // displays "boolean"Alert
small mistakes in JavaScript-------common error Four: comparison operatorsone of the more convenient parts of JavaScript is the ability to force each result variable in a comparison operation into a Boolean type. But on the other hand, sometimes it can bring us a lot of inconvenience, and here are some examples of code that have been bothering many programmers:Co
numbers here are the elements in the array;
Data type conversions and Nan:
Nan = = Nan: The return is a false
parseint (' 123abc '): Return is 123
parseint (' abc123 '): Nan is returned
Number (' 123abc '): Nan is returned
Number
The pen is studying quickguide.txtArticleAt the same time, according to the step-by-step method, when the result is run, it is found that such an error always occurs, "webform1" does not have a javascript error defined, changed to the project as the root directory, the error is stillUsing Google to search on the Intern
One, JavaScript error handlingError Handling Overview-error, which refers to an unhealthy state in the program, which is called "Exception" or "error" in other programming languages. The interpreter creates and throws an error object for each
Syntax errors, also known as parsing errors, occur in the compilation of traditional languages, occur in the interpretation of JavaScript, and runtime errors are also known as exceptions (exception, after the interpreter during compilation)
I. Error Classification
1. syntax error: it is also called a parsing error. I
This article mainly introduces JavaScript error handling materials. For more information, see
I. error category
1. Syntax error
It is also known as parsing errors. when a traditional programming language is compiled and interpreted in JavaScript, these errors are directly c
Article category: Web Front-endI. multiple choice questions
1. Which of the following statements will generate a running error :()A. var obj = ();B. var obj = [];C. var obj = {};D. var obj = //;
2. Which of the following words does not belong to a reserved javascript word :()A.B. parentC. classD. void
3. Select a true expression :()A. null instanceof ObjectB. null === undefinedC. null = undefinedD.
JavaScript binds this in a global function as a global object, and uses the same interpretation for nested functions. Let's look at a piece of JavaScript code nested with two-layer functions:
The Code is as follows:
Var me = {Name: 'jimbor ',Blog: 'http: // jmedia.cn /',SayMyName: function (){Var pre = 'My name is :';Function displayName (){Alert (pre + this. name );}DisplayName ();}}Me. sayMyName ();
F
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.