Skip to content

Commit b7bc364

Browse files
committed
Initial commit, completed getLength function with callbacks
1 parent afae86b commit b7bc364

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎assignments/callbacks.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ const items = ['Pencil', 'Notebook', 'yo-yo', 'Gum'];
2424

2525
function getLength(arr, cb) {
2626
// getLength passes the length of the array into the callback.
27+
return cb(arr.length);
2728
}
2829

30+
getLength(items, function(leng) {
31+
console.log(leng);
32+
})
33+
2934
function last(arr, cb) {
3035
// last passes the last item of the array into the callback.
3136
}

0 commit comments

Comments
 (0)