Javascript hasOwnProperty usage

I've seen hasOwnProperty used as:



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
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.

Big MontySenior Web Developer / CEO of Commented:
according to here the value with the parenthesis is required.

this doesn't seem to be valid JS
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.