How to check if an object is empty in javascript
There are a few ways to check if an object is empty in Javascript.
But I care about performance and readability.
The fastest way is to use a for...in
loop.
You could use the below code snippet as a utility function.
My favorite way for readability reasons and it's still high performing is using Object.keys
.
Note: Object.keys
is faster than using Object.entries
.