New answers tagged

2

The only difference in your if/elses looks to be the function you pass to this.chartData.reduce. Everything else is the same, so you can create an object of functions indexed by the newv, and look up the appropriate one to pass. You can also construct an array of values and an array of keys immediately by using Object.keys and Object.values: tab (newv, ...


Top 50 recent answers are included