Skip to content

Commit 7089145

Browse files
committed
Completed the "map" function of Underbar.
1 parent e612dad commit 7089145

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/underbar.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ var _ = {};
124124
// map() is a useful primitive iteration function that works a lot
125125
// like each(), but in addition to running the operation on all
126126
// the members, it also maintains an array of results.
127+
var results=[];
128+
129+
_.each(collection, function(val, key) {
130+
results.push(iterator(val, key));
131+
});
132+
133+
return results;
127134
};
128135

129136
/*

0 commit comments

Comments
 (0)