Javascript hasOwnProperty usage

I've seen hasOwnProperty used as:

if(elem[x].hasOwnProperty){

....
}

Open in new window


I was wondering how this worked and what this if statement was checking since I thought "hasOwnProperty" needed to be followed by a variable inside parantheses.  

Thanks in advance
Latitude34Asked:
Who is Participating?
 
COBOLdinosaurConnect With a Mentor Commented:
Actually what yhe is testing is whether hasOwnProperty exists. A Javascript prior ro 1.5 would return false or undefined.

Cd&
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
according to here the value with the parenthesis is required.

this doesn't seem to be valid JS
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.