javascript test for empty object
function isObjectEmpty(obj) {
return Object.keys(obj).length === 0;
}function isEmptyObject(obj) {
return !Object.keys(obj).length;
}// because Object.entries(new Date()).length === 0;
// we have to do some additional check
Object.entries(obj).length === 0 && obj.constructor === Object// because Object.keys(new Date()).length === 0;
// we have to do some additional check
Object.keys(obj).length === 0 && obj.constructor === Object
Also in JavaScript:
- jquery validator no space
- Angular comment
- javascript for group object properties based on another property
- object destructuring default value
- boble sorting javascript
- javascript how to check if image exists
- click anchor tag using jquery
- javascript array merge
- redirect to url in javascript
- d3js circle out of scrren
- change favicon with javascript
- double click on element using javascript
- access json python
- react function exec when button is clicked
- add webpack to react project tutorial
- jquery clear file input
- join three array javascript
- https with express
- node js favicon.ico
- apoolo uselaxyQuery bypass cache
- Trouble setting up sample table. “Could not find matching row model for rowModelType clientSide”
- python json.dumps pretty print
- send json post ajax javascript
- javascript email validation