Skip to content

Commit 4258f39

Browse files
committed
finished MVP callbacks
1 parent 758aef8 commit 4258f39

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

assignments/callbacks.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,22 @@ multiplyNums(5, 10, function(x, y) {
6565
function contains(item, list, cb) {
6666
// contains checks if an item is present inside of the given array/list.
6767
// Pass true to the callback if it is, otherwise pass false.
68+
if(list.includes(item)){
69+
return cb(true);
70+
} else {
71+
return cb(false);
72+
}
6873
}
6974

75+
contains('Pencil', items, function(result){
76+
console.log(result);
77+
});
78+
79+
contains('Pepper', items, function(result){
80+
console.log(result);
81+
});
82+
83+
7084
/* STRETCH PROBLEM */
7185

7286
function removeDuplicates(array, cb) {

0 commit comments

Comments
 (0)