I have 2 sets of nested arrays:
var values = [[100, 87.5, 87.5, 87.5, 100, 100],
[87.5, 100, 100, 100, 87.5, 87.5],
[75, 75, 75, 75, 75, 75],
[50, 50, 50, 62.5, 62.5, 62.5],
[62.5, 62.5, 62.5, 50, 37.5, 50],
[0, 0, 0, 0, 0, 0]];
var date = [["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"],
["2015", "2004", "2015", "2015", "2015", "2015"]];
What I'm trying to do is combine each array in Values and Date:
Get this :[100, 87.5, 87.5, 87.5, 100, 100]
Get this :["2015", "2004", "2015", "2015", "2015", "2015"]
Then combine like this:
[{y: 100, d:2015},{y:87.5, d: 2004},{y:87.5, d:2015}},{y:87.5, d:2015}},{y:100, d:2015}},{y:100, d:2015}]
example: https://jsfiddle.net/zidski/5808pgs4/3/
var result = values.map(function (n, i) {
return ({ y: n, d: values[i] });
});
But the whole array gets added.
flatMapstyle function, and maybe areduce. reactivex.io/learnrxArray#mapcalls. Likegrid.map((row, y) => row.map((item, x) => ... ))