zipObject() function
Creates an object by pairing keys with values position by position. Keys without a matching value get undefined, and extra values are ignored.
Signature:
typescript
declare function zipObject<const K extends PropertyKey, V>(keys: Iterable<K>, values: Iterable<V>): Record<K, V>;Example
ts
zipObject(["a", "b"], [1, 2]); // { a: 1, b: 2 }
zipObject(["a", "b", "c"], [1, 2]); // { a: 1, b: 2, c: undefined }
zipObject(["a", "b"], [1, 2, 3]); // { a: 1, b: 2 }