3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

《JavaScript》配列かどうか知りたい。

Last updated at Posted at 2017-11-17

IE9+

ES5 ではネイティブメソッドの Array.isArray() を使います。


Array.isArray([]);  // true
Array.isArray({});  // false

IE8-

IE8以下は文字列で判定します。


function isArray( obj ) {
  return Object.prototype.toString.call( obj ) === "[object Array]"
}

isArray([]);  // true
isArray({});  // false

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?