---
type: how-to
language: javascript
slug: array/search
title: "オブジェクトの配列から探す"
title_tag: "JavaScript 配列検索 — オブジェクトの配列から条件で探す"
summary: >
  1件なら find()、複数なら filter()、あるかどうかなら some()。大文字小文字や全角半角で
  見つからない理由、複数の項目をまたいで探す形、何度も引くなら Map にする判断まで確かめます。
description: >
  find() と filter() の使い分け、大文字小文字や全角半角で一致しない理由と直し方、
  複数の項目をまたいだ絞り込み、何度も引くときに Map へ切り替える判断まで示します。
status: published
difficulty: 2
minutes: 8

versions:
  verified: "Node 22.22.3"
  since: "ES2015"
  deprecated: null
  removed: null

sources:
  - title: "Array.prototype.find — ECMAScript® 2026 Language Specification"
    url: "https://tc39.es/ecma262/#sec-array.prototype.find"
  - title: "String.prototype.normalize — ECMAScript® 2026 Language Specification"
    url: "https://tc39.es/ecma262/#sec-string.prototype.normalize"
  - title: "Array.prototype.find() — MDN"
    url: "https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Array/find"

terms: [部分一致, 正規化, 索引]

links:
  related:
    - javascript/reference/array/find
    - javascript/reference/array/filter
    - javascript/reference/collection/map-set
    - javascript/reference/array/every-some

content_updated_at: 2026-09-09
published_at: 2026-09-09
---

## 答え

**欲しいものが何かで、使うものが決まります。**

```js run
const users = [
  { id: 1, name: '田中 太郎' },
  { id: 2, name: '佐藤 花子' },
];

console.log(users.find((user) => user.id === 2));
console.log(users.filter((user) => user.name.includes('田')));
console.log(users.some((user) => user.id === 1));
```
```output
{ id: 2, name: '佐藤 花子' }
[ { id: 1, name: '田中 太郎' } ]
true
```

| 欲しいもの | 使うもの | 見つからないとき |
|---|---|---|
| **1件**（要素そのもの） | `find()` | `undefined` |
| **全部**（配列） | `filter()` | `[]` |
| あるかどうか | `some()` | `false` |
| 何番目か | `findIndex()` | `-1` |

**`includes()` は使えません。** 中身の条件で探すなら `some()` です。
→ [every() と some()](/ja/javascript/reference/array/every-some/)

## 見つからないときに必ず備える

```js bad
const users = [{ id: 1, name: '田中' }];

const user = users.find((u) => u.id === 99);

console.log(user.name);
```
```output
TypeError: Cannot read properties of undefined (reading 'name')
```

**`find()` は空振りすると `undefined` を返します。**
その場で受け止めてください。

```js run
const users = [{ id: 1, name: '田中' }];

const user = users.find((u) => u.id === 99);

console.log(user?.name ?? '（見つかりません）');
```
```output
（見つかりません）
```

→ [?. と ??](/ja/javascript/reference/operator/optional-chaining/)

## 大文字小文字で見つからない

```js bad
const users = [{ email: 'TANAKA@example.com' }];

console.log(users.filter((user) => user.email.includes('tanaka')));
```
```output
[]
```

**入っているのに、空です。** `includes()` は1文字ずつそのまま比べます。

両方を同じ形に揃えてから比べてください。

```js run
const users = [{ email: 'TANAKA@example.com' }];
const keyword = 'tanaka';

console.log(
  users.filter((user) => user.email.toLowerCase().includes(keyword.toLowerCase())),
);
```
```output
[ { email: 'TANAKA@example.com' } ]
```

[bad:入力側だけ小さくしても意味がありません。] **両方を揃えます。**

## 全角・半角・濁点で見つからない

日本語では、**見た目が同じでも別の文字**であることがあります。

```js run
const decomposed = 'が';
const composed = 'が';

console.log(decomposed.length, composed.length);
console.log(decomposed === composed);
console.log([...decomposed].map((c) => c.codePointAt(0).toString(16)));
console.log(decomposed.normalize('NFC') === composed);
```
```output
2 1
false
[ '304b', '3099' ]
true
```

半角カナや全角英数も、`normalize('NFKC')` で揃います。

```js run
console.log('ﾀﾅｶ'.normalize('NFKC'));
console.log('ＡＢ'.normalize('NFKC'));
```
```output
タナカ
AB
```

検索用の値を、**あらかじめ1つ作っておく**のが確実です。

```js run
const normalize = (text) => text.normalize('NFKC').toLowerCase();

const users = [{ name: 'ﾀﾅｶ', email: 'TANAKA@example.com' }];
const keyword = normalize('たなか');

console.log(
  users
    .map((user) => ({ ...user, searchKey: normalize(user.name + user.email) }))
    .filter((user) => user.searchKey.includes(normalize('Tanaka'))),
);
```
```output
[ { name: 'ﾀﾅｶ', email: 'TANAKA@example.com', searchKey: 'タナカtanaka@example.com' } ]
```

[dim:ひらがなとカタカナは `normalize()` では揃いません。「たなか」で「タナカ」を出したいなら、別に変換が要ります。この例でも `keyword` は使わず、`'Tanaka'` で当てています。]
→ [文字を正しく数える](/ja/javascript/learn/string/unicode/)

## 複数の項目をまたいで探す

```js run
const users = [
  { name: '田中', email: 'a@example.com', tel: '090' },
  { name: '佐藤', email: 'b@example.com', tel: '080' },
];

const keyword = '090';

console.log(
  users.filter((user) =>
    ['name', 'email', 'tel'].some((key) => String(user[key]).includes(keyword)),
  ),
);
```
```output
[ { name: '田中', email: 'a@example.com', tel: '090' } ]
```

**探す項目を配列に書くと、増減が1か所で済みます。**

「どの項目でもよい」なら `Object.values()` です。

```js run
const users = [
  { name: '田中', email: 'a@example.com' },
  { name: '佐藤', email: 'b@example.com' },
];

console.log(
  users.filter((user) => Object.values(user).some((value) => String(value).includes('佐'))),
);
```
```output
[ { name: '佐藤', email: 'b@example.com' } ]
```

[bad:内部用の項目まで検索に含まれます。] 何を探すかは、明示するほうが安全です。

## 何度も引くなら `Map` にする

`find()` は**毎回、先頭から順に見ます。**
同じ配列を何度も引くなら、先に索引を作ってください。

```js run
const users = [
  { id: 1, name: 'a' },
  { id: 2, name: 'b' },
];

const byId = new Map(users.map((user) => [user.id, user]));

console.log(byId.get(2));
console.log(byId.get(99));
```
```output
{ id: 2, name: 'b' }
undefined
```

| 引く回数 | 使うもの |
|---|---|
| 1回だけ | `find()` |
| 何度も引く | **`Map` を作る** |

`Map` なら、件数が増えても引く速さが変わりません。
[dim:作るのに1回分の走査が要ります。1回しか引かないなら `find()` のほうが速く、短く書けます。]
→ [Map と Set](/ja/javascript/reference/collection/map-set/)

## まとめ

- 1件なら `find()`、全部なら `filter()`、有無なら `some()`
- **`find()` の空振りは `undefined`。** その場で受け止める
- 大文字小文字は[key:両方を揃えてから]比べる
- 日本語は `normalize('NFKC')` で揃える。**ひらがなとカタカナは揃わない**
- 複数の項目をまたぐなら、探す項目を配列で明示する
- 何度も引くなら[key:Map で索引を作る]
