1. Home
  2. Computing & Technology
  3. JavaScript

hasOwnProperty

By Stephen Chapman, About.com

Definition: The hasOwnProperty method allows you to test if the object has a particular property by passing that property to the method as a string. This is not a reserved word so you can declare your own variable or function called hasOwnProperty but if you do then you will not be able to test for the existance of properties.
Examples: if (obj.hasOwnProperty('top'))

Explore JavaScript

More from About.com

  1. Home
  2. Computing & Technology
  3. JavaScript
  4. Reference
  5. Javascript Glossary - hasOwnProperty

©2008 About.com, a part of The New York Times Company.

All rights reserved.