From ef2a110495a2d26e247ab6c7a1c512d291128b10 Mon Sep 17 00:00:00 2001 From: Olusegun Date: Wed, 26 Feb 2020 14:06:49 +0100 Subject: [PATCH 1/3] add code implementation for fizzBuzz :fire: --- session1/index_extra.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/session1/index_extra.js b/session1/index_extra.js index 5c36e0f4..e72def7c 100644 --- a/session1/index_extra.js +++ b/session1/index_extra.js @@ -1,4 +1,3 @@ -<<<<<<< HEAD // CHALLENGE 1: REVERSE A STRING // Return a string in reverse // ex. reverseString('hello') === 'olleh' @@ -232,13 +231,41 @@ function fizzBuzz() { // } // console.log(output); // } + +} + /* FIZZBUZZ - CONTRIBUTED SOLUTION BY @sheygs_ 👇*/ + + // generates a range of number between 1 and max + const generateMaxSequence = max => { + return Array(max) + .fill() + .map((_,i) => i + 1); +} + +const fizzBuzz = num => { + return generateMaxSequence(num).map(num => { + switch(true){ + case (num % 15 === 0): + return "FizzBuzz"; + case (num % 3 === 0): + return "Fizz"; + case (num % 5 === 0): + return "Buzz"; + default: + return num; + } + }). join(', '); } +const fizzBuzzSequence = fizzBuzz(30); + +/* FIZZBUZZ - CONTRIBUTED SOLUTION BY @sheygs_ 👆 */ + // Call Function const output = reverseString('hello'); console.log(output); -======= + // CHALLENGE 1: REVERSE A STRING // Return a string in reverse // ex. reverseString('hello') === 'olleh' @@ -412,4 +439,4 @@ function fizzBuzz() { const output = reverseString('hello'); console.log(output); ->>>>>>> e8090fea1d9fe2c208a8f8ce4cc46be9f287b108 + From 1f6840c177803576105ea77d26bfc22c3808ad91 Mon Sep 17 00:00:00 2001 From: Olusegun Date: Wed, 26 Feb 2020 14:07:37 +0100 Subject: [PATCH 2/3] :eyes: --- session1/index_extra.js | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/session1/index_extra.js b/session1/index_extra.js index e72def7c..a30c12b9 100644 --- a/session1/index_extra.js +++ b/session1/index_extra.js @@ -236,28 +236,28 @@ function fizzBuzz() { /* FIZZBUZZ - CONTRIBUTED SOLUTION BY @sheygs_ 👇*/ // generates a range of number between 1 and max - const generateMaxSequence = max => { - return Array(max) - .fill() - .map((_,i) => i + 1); -} - -const fizzBuzz = num => { - return generateMaxSequence(num).map(num => { - switch(true){ - case (num % 15 === 0): - return "FizzBuzz"; - case (num % 3 === 0): - return "Fizz"; - case (num % 5 === 0): - return "Buzz"; - default: - return num; - } - }). join(', '); -} - -const fizzBuzzSequence = fizzBuzz(30); +// const generateMaxSequence = max => { +// return Array(max) +// .fill() +// .map((_,i) => i + 1); +// } + +// const fizzBuzz = num => { +// return generateMaxSequence(num).map(num => { +// switch(true){ +// case (num % 15 === 0): +// return "FizzBuzz"; +// case (num % 3 === 0): +// return "Fizz"; +// case (num % 5 === 0): +// return "Buzz"; +// default: +// return num; +// } +// }). join(', '); +// } + +// const fizzBuzzSequence = fizzBuzz(30); /* FIZZBUZZ - CONTRIBUTED SOLUTION BY @sheygs_ 👆 */ From 9f44a768490c9b329c63d94e8cc6658021925f18 Mon Sep 17 00:00:00 2001 From: Olusegun Date: Wed, 26 Feb 2020 14:15:47 +0100 Subject: [PATCH 3/3] add code implementation for seekAndDestroy :fire: --- session3/index_extra.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/session3/index_extra.js b/session3/index_extra.js index 22a94c92..7fb8691c 100644 --- a/session3/index_extra.js +++ b/session3/index_extra.js @@ -46,6 +46,11 @@ console.log(sumAllPrimes(10)) function seekAndDestroy() {} +/* SEEKANDDESTROY CONTRIBUTED SOLUTION BY @sheygs_ 👇*/ + const seekAndDestroy = (list,...inputs) => list.filter(item => !inputs.includes(item)); +/* END OF CONTRIBUTED SOLUTION BY @sheygs_ 👆 */ + + // CHALLENGE 4: SORT BY HEIGHT // Some people are standing in a row in a park. There are trees between them which cannot be moved. Your task is to rearrange the people by their heights in a non-descending order without moving the trees. // ex.