isEmpty

.isEmpty()

Returns true if there are no elements in this array, and false if it has one or more.

If an array is empty, then it's size will be equal to zero. This function is intended as a more human readable alternative to checking if an array's size is zero.

arr = []
empty = arr.isEmpty() // set to true

arr = [ 5, 9, 20 ]
empty = arr.isEmpty() // set to false

arr = [ null, null ]
empty = arr.isEmpty() // set to false

See also

length - size