javascript check if object and not array