I initialized a localStorage variable with the following function:
if (!localStorage["store"]) {
var aaa = new Array();
localStorage["store"] = JSON.stringify(aaa);
}
It seems to work ok, but when I try use that array in order to add elements with the following code:
var one_stat = new Array( s1, s2 , resultat );
var statistics = JSON.parse(localStorage["store"]);
statistics.push( one_stat );
localStorage["store"] = JSON.stringify(statistics);
I get the following error:
Uncaught TypeError: Object [] has no method 'push'
I am using Google Chrome 10.0.648.151 on Ubuntu.
Does anyone know what I might be doing wrong?
Thanks.