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
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


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

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