Javascript Check If Variable Is Array An Object