Skip to content

Home > sculp-js > arrayEach

arrayEach() function

遍历数组,返回 false 中断遍历(支持continue和break操作)

Signature:

typescript
export declare function arrayEach<V>(array: ArrayLike<V>, iterator: (val: V, idx: number, arr: ArrayLike<V>) => boolean | void, reverse?: boolean): void;

Parameters

Parameter

Type

Description

array

ArrayLike<V>

iterator

(val: V, idx: number, arr: ArrayLike<V>) => boolean | void

迭代函数, 返回值为true时continue, 返回值为false时break

reverse

boolean

(Optional) 是否倒序

Returns:

void

{*}

Released under the MIT License.