Suppose I have the next javascript object:
var errors = { error_1: \"Error 1 description\", error_2: \"Error 2 description\", error_3: \"\",
In order to check whether the object is empty or not use this code.
if (Object.keys(object_name).length > 0) { // Your code }