Javascript hasOwnProperty usage

Posted on 2013-11-14
Medium Priority
Last Modified: 2013-12-10
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
Question by:Latitude34
LVL 53

Accepted Solution

COBOLdinosaur earned 2000 total points
ID: 39648270
Actually what yhe is testing is whether hasOwnProperty exists. A Javascript prior ro 1.5 would return false or undefined.

LVL 34

Expert Comment

by:Big Monty
ID: 39648421
according to here the value with the parenthesis is required.

this doesn't seem to be valid JS

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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.

Join & Write a Comment

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question