Function zipObject

  • This method is like fromPairs except that it accepts two arrays, one of property identifiers and one of corresponding values.

    Parameters

    • props: string[]

      The property identifiers.

    • values: any[]

      The property values.

    Returns any

    Returns the new object.

    Since

    5.3.0

    See

    [[unzip]],[[unzipWith]],[[zip]],[[zipObjectDeep]],[[zipWith]]

    Example

    zipObject(['a', 'b'], [1, 2])
    // => { 'a': 1, 'b': 2 }