I am writing a conditional statement which execute if an input is not empty but the issue is that input can either object or array.
if(response && response.length > 0 ) {
// but this failed if response is an object
}
So I am looking for single condition which check for both (object and array) in one line. Moreover, I checked that typeof
of array and object are object
var object_ = {};
var array_ = [];
console.log('typeof object', typeof object_); // object
console.log('typeof array', typeof array_); // object