hasOwnProperty in js

by SriSri M

HTML

up vote
28
down vote
accepted
	

hasOwnProperty returns a boolean value indicating whether the object on which you are calling it has a property with the name of the argument. For example

JavaScript

var x ={
y : 10
};
console.log(x.hasOwnProperty('y'));
console.log(x.y);