diff --git a/session1/index_extra.js b/session1/index_extra.js index 5c36e0f4..a30c12b9 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 + 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.