From d54c797b315e104ff38ba729ddad97237b014c41 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 28 May 2019 15:26:39 +0800 Subject: [PATCH 1/8] Filled user.json --- user.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user.json b/user.json index 4ac80a0..802040f 100644 --- a/user.json +++ b/user.json @@ -1,4 +1,4 @@ { - "name": "", - "email": "" + "name": "Diana Lyn C. Geromo", + "email": "diana.geromo@boom.camp" } From c1d909fe450a66d6448ed13267ab9173bc3ee677 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 28 May 2019 15:28:26 +0800 Subject: [PATCH 2/8] Problem 1 --- practice.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/practice.js b/practice.js index a9e0f69..d56c57d 100644 --- a/practice.js +++ b/practice.js @@ -28,6 +28,9 @@ */ // Code Here +function first(names, callback){ + return callback(names[0]); +} // Do not edit the code below. var names = ['Aodhan', 'Greg', 'Jake', 'Oscar', 'Aodhan', 'Tanner', 'Greg']; From 5e7a0a69d342d23ed567fb5cf28808da85a5d3f9 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 28 May 2019 15:29:34 +0800 Subject: [PATCH 3/8] Problem 2 --- practice.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/practice.js b/practice.js index d56c57d..d00389c 100644 --- a/practice.js +++ b/practice.js @@ -51,6 +51,10 @@ first(names, function(firstName){ */ //Code Here +function last(names, callback){ + return callback(names[names.length-1]); +} + // Do not edit the code below. last(names, function(lastName){ From b1c40c05c7a44aeaec40ceb803ef4061e22cbb5c Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 28 May 2019 15:30:28 +0800 Subject: [PATCH 4/8] Problem 3 --- practice.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/practice.js b/practice.js index d00389c..13db67d 100644 --- a/practice.js +++ b/practice.js @@ -73,6 +73,10 @@ last(names, function(lastName){ */ //Code Here +function multiply(n, c, callback){ + return callback(n*c); +} + // Do not edit the code below. multiply(4, 3, function(answer){ From 81d2a212c4a499003f606c702b8fd728a8722250 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 28 May 2019 15:32:14 +0800 Subject: [PATCH 5/8] Problem 4 --- practice.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/practice.js b/practice.js index 13db67d..3731ea5 100644 --- a/practice.js +++ b/practice.js @@ -96,6 +96,13 @@ multiply(4, 3, function(answer){ */ //Code Here +function contains(arr, name, callback){ + if(arr.includes(name)){ + return callback(true); + } else { + return callback(false); + } + } // Do not edit the code below. contains(names, 'Oscar', function(result){ From 4b130561247c241a784c26099c35ba0a87179c60 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 28 May 2019 15:33:08 +0800 Subject: [PATCH 6/8] Problem 5 --- practice.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/practice.js b/practice.js index 3731ea5..eeb3907 100644 --- a/practice.js +++ b/practice.js @@ -124,6 +124,11 @@ contains(names, 'Oscar', function(result){ */ //Code Here +function uniq(arr, callback){ + const uniqueAges = arr.filter((x, i, a) => a.indexOf(x) == i) + callback(uniqueAges); +} + // Do not edit the code below. uniq(names, function(uniqArr){ From 15b158396673d857105fcb7e90a690b4d7a57693 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 28 May 2019 15:34:11 +0800 Subject: [PATCH 7/8] Problem 6 --- practice.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/practice.js b/practice.js index eeb3907..586e041 100644 --- a/practice.js +++ b/practice.js @@ -146,6 +146,12 @@ uniq(names, function(uniqArr){ */ //Code Here +function each(names, callback){ + for (let c=0; c < names.length; c++){ + callback(names[c], c); + } +} + // Do not edit the code below. each(names, function(item, indice){ From eb71edbc3cd10fcae102ba0b05c0880db401814a Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 28 May 2019 15:35:01 +0800 Subject: [PATCH 8/8] Problem 7 --- practice.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/practice.js b/practice.js index 586e041..a9698e7 100644 --- a/practice.js +++ b/practice.js @@ -169,6 +169,13 @@ each(names, function(item, indice){ */ // Code here +function getUserById(users, id, callback){ + for (let c=0; c