From http://stackoverflow.com/questions/4775722/javascript-check-if-object-is-array