javascript - My Array holds previous values too every time i use. -



javascript - My Array holds previous values too every time i use. -

var transactionobject = { arr1: [], arr2: [] };

my array holds previous values every time utilize model class.

var info = update(transactionobject.arr1); jsonclient.send(data );

the first time array holds value, , next time when create request... adds previous info too... array not getting cleared @ all.

if want clear info each time before adding new data, somewhere code needs clear array. this:

transactionobject.arr1 = []; var info = update(transactionobject.arr1); jsonclient.send(data );

or, within update() function before putting info passed array:

var info = update(transactionobject.arr1); jsonclient.send(data ); function update(results) { results = []; // set info results }

javascript

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -