Introduction
In JavaScript, we may wish to check if an object is empty in JavaScript.
In this article, we'll learn how to check if an object is empty (do not confuse that with null|undefined).
How to check if an object is empty in JavaScript
There are several ways to check if an object is empty in JavaScript:
- in Vanilla JS:
- jQuery:
- lodash:
- Underscore:
- Hoek:
- ExtJS:
- AngularJS (version 1):
- Ramda:
Conclusion
In this article, we presented several ways to check if an object is empty. Frameworks like Angular or jQuery have built-in solutions to do that verification. We can also use a solution in vanilla JS.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}