spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column59


IE 5.5: Formatting, URIs, and Stack Operations

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Detecting Object-Property Ownership

IE5.5 introduced a score of new operators and methods for detecting various object-property relationships. The in operator checks if a given property is defined for a given object. Suppose the object line is of type Array:

line = new Array("aaa", "bbb", "ccc", "ddd", "eee");

We know that the object line inherited the Array's properties such as its length. If we check whether length is in line (length in line), we should get a true value. Notice that the array should not be empty, or else the returned answer will be a false value.

Similarly, the method hasOwnProperty does exactly what the in operator does. The expression line.hasOwnProperty(length) should return a true value.

The method propertyIsEnumerable() checks, again, that the given property belongs to the given object. Once it belongs, every property is automatically enumerable in the for...in loops. The for...in loop loops through the existing properties of a given object. The check line.propertyIsEnumerable(length) should return a true value.

Next: How to encode and decode URIs

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: March 14, 2000
Revised: April 26, 2000

URL: http://www.webreference.com/js/column59/6.html