HasOwnProperty () method User Guide in javascript, hasownproperty
Overview
The hasOwnProperty () method is used to determine whether an object contains the specified attributes.
SyntaxObj. hasOwnProperty (prop)
Parameters
• Prop
• Name of the
HasOwnProperty is the only method that can complete this task when detecting whether an object has a certain attribute. During the forin loop, we recommend that you add hasOwnProperty for determination, compared with the in operator, for in also
Compared with the in operator, for in traverses the prototype chain during the attributes of the loop object. for in does not read non-enumeration attributes, such as The length attribute of an array. Summary when detecting whether an object has a
Guide to Using hasOwnProperty () in javascript
This article describes in detail how to use hasOwnProperty () in javascript. It is very comprehensive and recommended to anyone who needs it.
Overview
The hasOwnProperty () method is used to
This article describes in detail how to use hasOwnProperty () in javascript. it is very comprehensive and recommended to anyone who needs it.
Overview
The hasOwnProperty () method is used to determine whether an object contains the specified
In contrast to the in operator, for-in loops through the prototype chain when iterating over the object's properties, for-in does not read an enumerable property, such as the length property of the group. Summary when you detect whether an object
To determine whether an attribute is defined in the Object itself rather than inheriting from the prototype chain, we need to use the hasOwnProperty method inherited from Object. prototype. The hasOwnProperty method is the only method in Javascript
The previous 43 and 44 discussed the enumeration of attributes, but none of them completely solved the problem of property lookup for Zhongyuan pollution. Take a look at some of the following dictionary operations‘zhangsan‘ in
Both of these properties are provided by Object.prototype: Object.prototype.hasOwnProperty () and Object.prototype.isPropertyOf ()
First explain the hasOwnProperty () method and use. Explain the ispropertyof () method and use
At least understand
Constructor: constructor of an object. It is a function.
Prototype: the prototype of the constructor. Only functions have this attribute.
Isprototypeof: If object a exists in the original model chain of object OBJ, A. isprototypeof (OBJ) returns
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.