From baff15ccd891a4d48d4eca51e3026ee72821e7b3 Mon Sep 17 00:00:00 2001 From: Sahil Kalra Date: Mon, 14 Aug 2017 16:30:51 -0700 Subject: [PATCH 1/3] Adds test file and solution --- lesson2/sol.js | 5 +++++ lesson2/testSol.js | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 lesson2/sol.js create mode 100644 lesson2/testSol.js diff --git a/lesson2/sol.js b/lesson2/sol.js new file mode 100644 index 0000000..1464913 --- /dev/null +++ b/lesson2/sol.js @@ -0,0 +1,5 @@ +const add = (a,b) => { + return a+b; +} + +module.exports = add; diff --git a/lesson2/testSol.js b/lesson2/testSol.js new file mode 100644 index 0000000..58c0864 --- /dev/null +++ b/lesson2/testSol.js @@ -0,0 +1,10 @@ +const addFunction = require('./sol.js'); + +const test = (a,b,c) => { + const result = (addFunction(a,b) === c) ? console.log('Correct') : console.log('Wrong') + return result; +} + +test(2,2,4); +test(2,6,8); +test(-1,-1,-2); From 0f1b8aea1a732d332e282a8ad2b7bd99e6943ed9 Mon Sep 17 00:00:00 2001 From: Sahil Kalra Date: Mon, 14 Aug 2017 16:40:40 -0700 Subject: [PATCH 2/3] Fix syntax issues --- lesson2/testSol.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lesson2/testSol.js b/lesson2/testSol.js index 58c0864..e307582 100644 --- a/lesson2/testSol.js +++ b/lesson2/testSol.js @@ -1,8 +1,7 @@ const addFunction = require('./sol.js'); const test = (a,b,c) => { - const result = (addFunction(a,b) === c) ? console.log('Correct') : console.log('Wrong') - return result; + addFunction(a,b) === c ? console.log('Correct') : console.log('Wrong') } test(2,2,4); From c20cc149c966e96264d99546aaaf93be3ca36f58 Mon Sep 17 00:00:00 2001 From: Sahil Kalra Date: Tue, 15 Aug 2017 13:54:05 -0700 Subject: [PATCH 3/3] Adds challenge file --- challenge.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 challenge.js diff --git a/challenge.js b/challenge.js new file mode 100644 index 0000000..b7164cd --- /dev/null +++ b/challenge.js @@ -0,0 +1,9 @@ +const challenge = (array) => { + let number = 0; + while(array.length !== 0){ + number = array.shift() + if(number + 1 !== array[0]) + break; + } + return number + 1; +}