I want to add the object value to cookie array without push array to cookie. how can i do that ?i can use cookieDevObjArray.push(obj); but i want to push my object to cookie not whole array.How can i do that any help? Here is object
var obj =
{
'deviceid': deviceId,
'full': cookiefull,
'stacked': istoggle
};
$.cookie("cookieDevObjArray", + JSON.stringify(obj), { expires: 30 });
this code only save current object and override previous data.
newCookieObjArray = [...cookieObjArray,...obj]. Just use it like this:...objThespreadoperator only takeskey:valuepairs from an array instead of the whole array/object