I have an array of objects (containing my stimuli) and a function (see extract below) that collects reaction times and 'pushes' all reaction times to a global variable.
var stim = [ {name:"A", path:".../a.jpg", type: P},
{name:"A", path:".../a.jpg", type: T},
{name:"A", path:".../a.jpg", type: I}
];
var reac_arr = [];
$(function(){ ... var reac_time = t2-t1;
react_arr.push(reac_time);
};
Now I want to add the variable with all my reaction times to stim as object "reaction". So that in the end I have the reaction time, the type, the path, and the name for all my stimuli, something like this:
var stim = [ {name:"A", path:".../a.jpg", type: P, reaction: 123},
{name:"A", path:".../a.jpg", type: T, reaction: 876},
{name:"A", path:".../a.jpg", type: I, reaction: 725}
];
I tried:
stim.reaction = react_arr;
but that's not working.
I need this to analyse how reaction times differ across different types of stimuli. I found answers on this for java but these weren't helping for my problem.