Skip to content

Commit 46376f4

Browse files
author
KatieAJenkins
committed
create object
1 parent 743e6b0 commit 46376f4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

reduce/core.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,19 @@ function objectify (array) {
5050
// your code here
5151
//cartoonObject is our accumulator object, so also need {}
5252
//reach row is the element being passed in which is an array
53+
//console log to get the keys and values to populate our cartoonObject
54+
//create cartoonObject
55+
//return cartoonObject starting variable
5356
return array.reduce(function(cartoonObject, row){
54-
5557
console.log('row ', row[0]);
56-
// console.log(newObject);
58+
console.log('row2 ', row[1]);
59+
cartoonObject[row[0]] = row[1];
60+
console.log('cartoonObject ', cartoonObject);
5761

5862
console.log(cartoonObject);
5963
return cartoonObject;
60-
}, {});
64+
},
65+
{});
6166
}
6267

6368
objectify(input2);

0 commit comments

Comments
 (0)