Use Array.isArray rather than jQuery.