diff --git a/questions/zipObj-a.js b/questions/zipObj-a.js new file mode 100644 index 0000000..2393d5c --- /dev/null +++ b/questions/zipObj-a.js @@ -0,0 +1,6 @@ +function zipObj(list1, list2) { + return list1.reduce((result, curr, index) => { + result[curr] = list2[index]; + return result; + }, {}); + } \ No newline at end of file diff --git a/questions/zipObj.js b/questions/zipObj.js new file mode 100644 index 0000000..ab69cb4 --- /dev/null +++ b/questions/zipObj.js @@ -0,0 +1,3 @@ +//write a function that returns a new object out of a list of keys and a list of values + +//zipObj(['a', 'b', 'c'], [1, 2, 3]) {a: 1, b: 2, c: 3} \ No newline at end of file