Check if javascript array is empty

#array#empty#exists#javascript#jquery
if (typeof(my_array) !== 'undefined' && my_array.length > 0){
    // the array is defined and has at least one element
}