中文
Appearance
查找 Iterable/AsyncIterable 中的每个值,返回通过真值测试 f 的第一个值,如果没有值通过测试则返回 undefined。
f
undefined
Signature:
declare function find<T>( f: (a: T) => unknown, iterable: Iterable<T>, ): T | undefined;
find((a) => a === 2, [1, 2, 3, 4]); // 2 find((a) => a === "r", "marpple"); // 'r'
Try It
Open Source Code