Scotch / Bar Talk

Code Challenge #11: JavaScript Functional Programming

Code Challenge #11: JavaScript Functional Programming

Scotch/Bar Talk · June 12, 2018 at 8:30pm

Code Challenge #11: JavaScript Functional Programming

Scotch / Bar Talk · June 12, 2018 at 8:30pm(Edited 4 months 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...
Code Challenge #11: JavaScript Functional Programming
http://scotch.io/bar-talk/code-challenge-11-javascript-functional-programming

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 @scotch_io

Code Challenge #11: JavaScript Functional Programming

https://codepen.io/leandrw/pen/xzLYwX

like-fill
2
  • reply
  • like

June 18, 2018 at 3:54pm

#scotchchallenge @scotch_io

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

https://codepen.io/dnunag/pen/ZMXZOv?editors=0010

  • reply
  • like

September 7, 2018 at 11:59am

@scotch_io

Code Challenge #13: Going From ES5 to ES6

https://codepen.io/devopsjay/pen/bxYEXo

  • reply
  • like

Code Challenge #13: Going From ES5 to ES6

https://codepen.io/jidelambo/pen/oPoNZE?editors=1111

  • reply
  • like

Code Challenge #13: Going From ES5 to ES6 https://codepen.io/sonen/pen/XPzNKw?editors=1111

  • reply
  • like
Your message here...

*bold*_italic_`code````codeblock```