I want to ask which is the right way to check if an ajax response object has a property . I googled and what I found is that there are different ways to approach this.
For example:
if(ajaxResponse.hasOwnProperty('someProperty')){
//do blah blah
}
but there are other ways for sure, for example :
if(typeof ajaxResponse.someProperty !== 'undefined')){
//do blah blah
}
So I am guessing there are some pros and cons can you please share these with me.
Thanks