
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
要素の抽出・削除・書き換えなどの配列操作(JavaScript) - Qiita
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
要素の抽出・削除・書き換えなどの配列操作(JavaScript) - Qiita
const fruits = ["banana", "apple", "apple", "orange", "grape", "apple"]; // fromを使う方法 const ... const fruits = ["banana", "apple", "apple", "orange", "grape", "apple"]; // fromを使う方法 const uniqueFruits = Array.from(new Set(fruits)); console.log(uniqueFruits) // ...を使う方法 const uniqueFruits2 = [...new Set(fruits)]; console.log(uniqueFruits2) // 共に ["banana", "apple", "orange", "grape"] // 従来の方法(おすすめしない) const result = fruits.filter((x, i, self) => { return self.indexOf(x) === i; }); console.log