I have this code running on Parse.com CloudCode
queryContact.find().then(function(results) {
console.log(typeof results); // object
if (results.constructor !== Array) {
response.success("Found zero results");
} else {
console.log("WHY DID IT GO THROUGH!!!");
}
}).then...
The find() function normally returns an array, but in my test case it returns 0 results. By logging to console I managed to see that in this case results is a typeof object. I want to proceed with else case only if results is typeof Array. However, my checks fail to capture this, and the code keeps falling through into the else section. None of the checks from this SO question work for me.