I have a javascript object called file, I am trying to check if this object has file.xhr.response property contained in it. I have tried like this..
if (file.xhr.response) {
console.log(Exists);
} else {
console.log(Missing);
}
This works when file.xhr.response exists but if it doesn't then it throws an error...
Uncaught TypeError: Cannot read property 'response' of undefined
Where am I going wrong?
Cannot read property 'response' of undefinedit doesn't mean thatresponsedoesn't exist but rather then it's parent doesn't exist, in your casexhr.responseis not defined but the code you put in the question doesn't useresponseat all. The problem is not in the code you've shared.