This is mainly about the type judgment function of JavaScript typeof and judging the use and attention of the prototype instanceof of the constructor.
typeof
Let's talk about typeof first. The first thing to note is that the TypeOf method returns
The following is a detailed introduction to the typeof operator and some usage, analysis, and learning of typeof operators. After reading this article, we should be able to gain some benefits. The following is a detailed introduction to the typeof
A deep understanding of typeof and instanceof javascript
This time I will talk about the usage and attention of the javascript type judgment function typeof and the constructor prototype instanceof.
Typeof
Let's talk about it first.TypeofRight. Note
This article mainly introduces the usage and differences of the instanceof and typeof operators in JavaScript. For more information, see instanceof and typeof in JavaScript ), however, they are used differently:
Typeof OperatorReturns a string that
typeof operatorReturns a string that is used to represent the data type of an expression.
typeof[() expression[]];
The expression parameter is any expression that needs to find the type information.
DescriptionThe typeof operator returns the type
The typeof in JavaScript is actually very complicated. It has six types of returned data, which can be used to do many things, but it also has a lot of weird performances. this article lists its usage. For more information, see. Arrays are used in
In JS used in the array, such as multiple names of the same () input, if the dynamic generation (of), the submission of the need to determine whether it is an array. if (document.mylist.length!= "undefined") {} This usage is incorrect.Correct () is
Instanceof and typeof in JavaScript are often used to determine what type of variable is (an instance), but their use is different:
typeof operatorReturns a string that is used to represent the data type of an expression.
typeof expression;
The
The classification of several return results of typeof:Transferred from: http://www.360doc.com/content/14/0718/15/8790037_395279403.shtmlThe typeof operator describes:TypeOf is a unary operation that can be any type before it is placed in an operand.
Note: The array in JavaScript is not an associative array. Only objects in JavaScript can manage the corresponding relationship of key values. But associative arrays are kept in order, and objects are not.
Because the for in loop enumerates all the
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.