Skip to content

forEach

forEach(target, fn)

Executes fn function for each key-value pair in target object and returns the original object.

ts
forEach({ a: 1, b: 2 }, ([key, value]) => console.log(key, value)); // { a: 1, b: 2 }
ts
pipe(
    { a: 1, b: 2 },
    forEach(([key, value]) => console.log(key, value)),
); // { a: 1, b: 2 }