0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JavaScriptのArray.isArray()関数:配列型を確認する

0
Last updated at Posted at 2026-06-10

😄この投稿は、codingeverybody.jpのコンテンツをもとに作成しています。

概念と使用方法

Array.isArray()関数は指定された値が配列であるかどうかを判定するために使用されます。この関数は渡された引数が配列である場合はtrueを、そうでない場合はfalseを返します。

基本の例

const arr = [1, 2, 3];
const obj = {name: "山田太郎"};

console.log(Array.isArray(arr));    // true(配列)
console.log(Array.isArray(obj));    // false(配列ではない)

構文

Array.isArray(value);

valueは配列かどうかを確認する値です。valueが配列であればtrue、配列でなければfalseを返します。

// 全てtrueを返す
Array.isArray([]);
Array.isArray([1]);
Array.isArray(new Array());
Array.isArray(new Array("a", "b", "c", "d"));
Array.isArray(new Array(3));

// 全てfalseを返す
Array.isArray();
Array.isArray({});
Array.isArray(null);
Array.isArray(undefined);
Array.isArray(17);
Array.isArray("Array");
Array.isArray(true);
Array.isArray(false);

参考資料

codingEverybody:JavaScript Array.isArray()関数:配列型を確認する
0
0
3

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?