Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function processFirstItem(stringList, callback) {
* [2] Invoking `processLength` passing `[]` and `(num) => "There are " + num`,
* should return "There are 0".
*/
function processLength(/* CODE HERE */) {
/* CODE HERE */
function processLength(list, callback) {
return callback list.length;
}

/**
Expand All @@ -66,8 +66,8 @@ function processLength(/* CODE HERE */) {
* Invoking `processLastItem` passing `['foo', 'bar']` and `(str) => str + str`,
* should return 'barbar'.
*/
function processLastItem(/* CODE HERE */) {
/* CODE HERE */
function processLastItem(stringList, callback) {

}

/**
Expand All @@ -88,8 +88,13 @@ function processLastItem(/* CODE HERE */) {
* [2] Invoking `processSum` passing `-5`, '-1', and `(num) => num + 1000`,
* should return 994.
*/
function processSum(/* CODE HERE */) {
/* CODE HERE */
function processSum(num1, num2, callback) {
return callback(num1, num2)

}

const add = function(num1, num2){
return num1+num2;
}

/**
Expand All @@ -110,8 +115,12 @@ function processSum(/* CODE HERE */) {
* [2] Invoking `processProduct` passing 25 and 0 and `(num) => num + 1000`,
* should return 1000.
*/
function processProduct(/* CODE HERE */) {
/* CODE HERE */
function processProduct(num1, num2, cb) {
return cb(num1, num2)
}

const product = function(num1, num2){
return num1 * num2;
}

/**
Expand Down