I have an object, which itself includes arrays
how to check if such object is empty or not in javascript (or in Angular.js) ?
You can create a function to see if the object has any enumerable properties:
function isEmptyObject(obj) {
if (!obj || typeof obj !== "object") {
throw new Error("Must pass object");
}
return Object.keys(obj).length === 0;
}
Or, if you don't want the type checking:
function isEmptyObject(obj) {
return Object.keys(obj).length === 0;
}