我想将每次点击数据保存并添加到数组中。我试过这个
var data = [];
var save = [];
s=0;
i=0;
some called function(){
data[i++] = some result;
data[i++] = some other result;
}
$('#someelement').click(function(){
save[s++] = data;
console.log(save); // for debugging
i = 0;
data = '';
});
第一次保存有效,但之后我只添加了空数组。任何指针?