Skip to content

Commit 94dbe03

Browse files
committed
answered ? 2 callbacks
1 parent 6885f33 commit 94dbe03

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

assignments/callbacks.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ getLength(items, (length) => {
3333

3434
function last(arr, cb) {
3535
// last passes the last item of the array into the callback.
36+
37+
return cb(arr[arr.length-1]);
3638
}
3739

40+
last(items, function(lastItem) {
41+
console.log(lastItem);
42+
});
43+
3844
function sumNums(x, y, cb) {
3945
// sumNums adds two numbers (x, y) and passes the result to the callback.
4046
}

0 commit comments

Comments
 (0)