Horje
js is object empty Code Example
js is object empty
function isObjectEmpty(obj) {
    return Object.keys(obj).length === 0;
}
express check if object is empty
if(Object.keys(obj).length === 0) {

}
javascript check empty object
function isEmptyObject(obj) {
    return !Object.keys(obj).length;
}
check if object is empty javascript
const empty = {};
/* -------------------------
  Plain JS for Newer Browser
----------------------------*/
Object.keys(empty).length === 0 && empty.constructor === Object
// true
/* -------------------------
  Lodash for Older Browser
----------------------------*/
_.isEmpty(empty)
// true
Source: medium.com
js check if object is empty
> !!Object.keys(obj).length;
es6 check if the object is empty
Object.entries(objectToCheck).length === 0




Javascript

Related
js get number of keys in object Code Example js get number of keys in object Code Example
Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If Code Example Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If Code Example
how to extract domain name of url of current page in javascript Code Example how to extract domain name of url of current page in javascript Code Example
chartjs bar chart hover color Code Example chartjs bar chart hover color Code Example
disable console log alert eslint Code Example disable console log alert eslint Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8