Answers for "javascript is object is empty"

6

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
Posted by: Guest on December-07-2020
0

javascript test for empty object

const empty = {};
/* -------------------------
  Plain JS for Newer Browser
----------------------------*/
Object.keys(empty).length === 0 && empty.constructor === Object
// true
/* -------------------------
  Lodash for Older Browser
----------------------------*/
_.isEmpty(empty)
// true
Posted by: Guest on February-20-2020

Code answers related to "javascript is object is empty"

Code answers related to "Javascript"

Browse Popular Code Answers by Language