Skip to content

Commit 78ed806

Browse files
committed
fixed a bug in callbacks.js
1 parent c775fa2 commit 78ed806

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎assignments/callbacks.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function first(items) {
3939

4040
// Anonymous Function Approach
4141
function firstItem(arr, cb) {
42-
return cb(arr);
42+
return cb(arr[0]);
4343
}
4444

4545
firstItem(items, function(first) {
@@ -48,6 +48,8 @@ firstItem(items, function(first) {
4848

4949
// firstItem(items, first); // Pencil
5050

51+
52+
5153
function getLength(arr, cb) {
5254
// getLength passes the length of the array into the callback.
5355
return cb(arr);

0 commit comments

Comments
 (0)