software-developer-org / bootcamp

Bootcamp for self-study on tools, languages, etc
1 stars 0 forks source link

Learn JavaScript #14

Open taitruong opened 4 years ago

taitruong commented 4 years ago

Goal: learn by developing a JavaScript solution

taitruong commented 4 years ago

Summarize your learnings in a series of blogs:

taitruong commented 4 years ago

Please remember: put all your exercises and notes on your personal github repo. Use git and vi :)!

taitruong commented 4 years ago

Here is one little exercise: map a one-dimensional array into a 2-dimensional matrix (=table).

Given input is a one dimensional array like:

Transform input into a nested/two-dimensional array. Like [1,2,3,4,5,6,7,8,9] => [ [1,2,3], [4,5,6],[7,8,9]]

Provide two types of solutions:

  1. "Imperative style" using for loop
  2. "functional style" using map, filter, reduce (functions on array)