var emptyArray = [];
var emptyObject = {};
if (JSON.stringify(emptyArray) == '[]') {
console.log('This array is empty');
}
if (JSON.stringify(emptyObject) == '{}') {
console.log('This object is empty');
}
JSON.stringify(array) == '[]'
JSON.stringify(object) == '{}'