Can anyone advise on the best approach to check if an ajax response object has a specific property? I've done some research and it seems there are various methods to do this.
One way is:
if(ajaxResponse.hasOwnProperty('someProperty')){
//do something
}
However, there are other techniques as well. For example:
if(typeof ajaxResponse.someProperty !== 'undefined'){
//do something
}
I assume each method has its own advantages and disadvantages. Can someone please elaborate on these for me?
Thank you!