Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


How to I check if an object has a property in JavaScript?


How do I check if an object has a property in JavaScript?

Consider:

x = {'key': 1};
if ( x.hasOwnProperty('key') ) {
    //Do this
}

Is that the best way to do that?

 


asked Jun 30, 2015 in JAVASCRIPT by rajesh
0 votes
56 views



Related Hot Questions



Government Jobs Opening


...