menu
Channels
Team

Code Challenge #11: JavaScript Functional Programming

June 12, 2018 at 8:30pm

Code Challenge #11: JavaScript Functional Programming

June 12, 2018 at 8:30pm (Edited 2 years ago)
https://scotch.io/bar-talk/code-challenge-11-javascript-functional-programming
This week on the code challenge, we'll be re-visiting the basics of JavaScript with Arrays.
This challenge is quite unique such that we will be using some really useful built-in array methods to manipulate the provided arrays. Three arrays are provided and each comes with 3 problem parts to be solved...

June 12, 2018 at 8:33pm
Let's go back to the basics!
  • reply
  • like
Nice!
  • reply
  • like

June 13, 2018 at 3:16am
Very impressive
like-fill
1
  • reply
  • like

June 14, 2018 at 4:27pm
by far `.sort` is the hardest function to implement by hand
  • reply
  • like

June 18, 2018 at 1:05am
#scotchchallenge
Code Challenge #11: JavaScript Functional Programming
like-fill
2
  • reply
  • like

June 18, 2018 at 3:54pm
#scotchchallenge
Code Challenge #11: JavaScript Functional Programming https://codepen.io/Adroit11/pen/MXOxVv
like-fill
2
  • reply
  • like
Nice!
  • reply
  • like

June 24, 2018 at 10:25am
I tried it too!
  • reply
  • like
To find the total age of the users you don't even need .map() :D
  • reply
  • like
You can use .reduce()'s second argument, the initial value!
  • reply
  • like
const ageSum = [(p, c) => p + c.age, 0];
console.log(texasss.reduce(...ageSum)) // 202
  • reply
  • like
And using that, especially the last challenge is really simple in just one line:
  • reply
  • like
[...texasss, ...newieyork, ...vegzas].reduce(...ageSum) // 529
  • reply
  • like
I didn't want to use CodPen btw, I used repl.it instead: https://repl.it/repls/BluevioletUnderstatedCharacter
  • reply
  • like

September 5, 2018 at 1:52pm

September 7, 2018 at 4:32am
Code Challenge #13: Going From ES5 to ES6
  • reply
  • like

September 7, 2018 at 11:59am
Code Challenge #13: Going From ES5 to ES6
  • reply
  • like
Code Challenge #13: Going From ES5 to ES6
  • reply
  • like
Code Challenge #13: Going From ES5 to ES6 https://codepen.io/sonen/pen/XPzNKw?editors=1111
  • reply
  • like

January 10, 2020 at 12:12pm
Array Algo Challenge Base
via
  • reply
  • like