From 07c5ee65d8b12faef54c51d065efcf660a6b9dd8 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Thu, 21 Dec 2017 11:13:38 +0200 Subject: [PATCH] Update zipObject.md --- snippets/zipObject.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/zipObject.md b/snippets/zipObject.md index a698038b9..f9214e7aa 100644 --- a/snippets/zipObject.md +++ b/snippets/zipObject.md @@ -1,8 +1,8 @@ ### zipObject -Given an array of valid property identifiers and an array of values, `zipObject` returns an object associating the properties to the values +Given an array of valid property identifiers and an array of values, return an object associating the properties to the values. -Since an object can have undefined values but not undefined property pointers, the array of properties is used to decide the structure of the resulting object through a `reduce` +Since an object can have undefined values but not undefined property pointers, the array of properties is used to decide the structure of the resulting object using `Array.reduce()`. ```js const zipObject = ( props, values ) => props.reduce( ( obj, prop, index ) => ( obj[prop] = values[index], obj ), {} )