SyntaxFix
Write A Post
Hire A Developer
Questions
You can use jQuery's isEmptyObject() to check whether the array contains elements or not.
isEmptyObject()
var testArray=[1,2,3,4,5]; var testArray1=[]; console.log(jQuery.isEmptyObject(testArray)); //false console.log(jQuery.isEmptyObject(testArray1)); //true
Source: https://api.jquery.com/jQuery.isEmptyObject/