keepup-ECMAScript
CtrlK
  • About
  • Proposal
    • using
    • Temporal
  • ES2025
    • Promise.try
    • Sync Iterator helpers
    • Import Attributes
    • JSON Modules
    • New Set Methods
    • RegExp Modifiers
    • Duplicate named capture groups
  • ES2024
    • Resizable and growable ArrayBuffers
    • RegExp v flag with set notation + properties of strings
    • Atomics.waitAsync
    • Well-Formed Unicode Strings
    • array grouping
    • Promise withResolvers
  • ES2023
    • Symbols as WeakMap key
    • Hashbang Grammar
    • Array.findLast, findLastIndex
    • 配列の非破壊操作
  • ES2022
    • Private class fields
    • Regexp match indices
    • Top-level await
    • Private fields in-in
    • Array.at
    • Object.hasOwn
    • Class static block
    • Error cause
GitBook提供
このページ内
  • findLast
  • findLastIndex
  • 既存のメソッド
GitHubで編集
  1. ES2023

Array.findLast, findLastIndex

findLast

const array = [1,10,100];

array.findLast(v => v >= 10);
> 100

findLastIndex

const array = [1,10,100];

array.findLastIndex(v => v >= 10);
> 2

既存のメソッド

最初に見つかった要素が欲しい時は find findIndex を使う。

const array = [1,10,100];

array.find(v => v >= 10);
> 10

array.findIndex(v => v >= 10);
> 1
前へHashbang Grammar次へ配列の非破壊操作

最終更新 2 年前