Skip to content

Instantly share code, notes, and snippets.

@RuNpiXelruN
Created March 5, 2019 06:16
Show Gist options
  • Save RuNpiXelruN/94c3642341156ac343c11d9787224f11 to your computer and use it in GitHub Desktop.
Save RuNpiXelruN/94c3642341156ac343c11d9787224f11 to your computer and use it in GitHub Desktop.
Merge two arrays into an object
const keys = [ "height", "width" ]
const values = [ "12px", "24px" ]
const merged = values.reduce((obj, value, index) => ({...obj, [keys[index]]: value}), {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment