I currently have different methods implemented to create a certain history array. For example, to get a pure steps array, I do the following:
function createStepsArray(hist, curSteps) {
var arr = new [8];
arr = [0, 0, 0, 0, 0, 0, 0, 0];
arr[0] = curSteps;
if (null != hist && hist.size() > 0) {
for (var i = 0; i < hist.size(); ++i) {
if (null != hist&& null != hist.steps) {
arr[i+1] = hist.steps;
}
}
}
return arr;
}
[/CODE]
This works pretty well. Nevertheless, I have to duplicate the code for distance, for stairs, for stepgoal, etc. Is there a more intelligent way to create such an array? I would like to make "steps" a parameter of the function but I don't know if this is possible. Any suggestions?