diff --git a/practice.js b/practice.js index a9e0f69..08386fd 100644 --- a/practice.js +++ b/practice.js @@ -28,7 +28,9 @@ */ // Code Here - +function first(arr,cb){ + return cb(arr[0]); +} // Do not edit the code below. var names = ['Aodhan', 'Greg', 'Jake', 'Oscar', 'Aodhan', 'Tanner', 'Greg']; @@ -49,6 +51,10 @@ first(names, function(firstName){ //Code Here +function last(arr,cb){ + return cb(arr[arr.length-1]); +} + // Do not edit the code below. last(names, function(lastName){ console.log('The last name in names is ' + lastName); @@ -66,7 +72,9 @@ last(names, function(lastName){ */ //Code Here - +function multiply(x,y,cb){ + return cb(x * y); +} // Do not edit the code below. multiply(4, 3, function(answer){ console.log('The answer is ' + answer); //should console.log "The answer is 12" @@ -85,7 +93,15 @@ multiply(4, 3, function(answer){ */ //Code Here - +function contains(arrr,name,cb){ + for(let i=0; i { + indice += 1; + return cb(element,indice) + }); + + // for(let i=0;i