Js-cookie: why did not provide clear or removeAll method?

Created on 19 Aug 2019  路  3Comments  路  Source: js-cookie/js-cookie

I want remove all cookies ,have any methods provide?

Most helpful comment

Wait, the latter example won't work, the forEach() callback takes more than 1 argument.

This should work:

Object.keys(Cookies.get()).forEach(key => Cookies.remove(key));

All 3 comments

Something like:

for (var c in Cookies.get()) {
    Cookies.remove(c);
}

If you鈥檙e able to utilize newer JavaScript features:

Object.keys(Cookies.get()).forEach(Cookies.remove);

Wait, the latter example won't work, the forEach() callback takes more than 1 argument.

This should work:

Object.keys(Cookies.get()).forEach(key => Cookies.remove(key));

path of cookie will be uneffcetive

Was this page helpful?
0 / 5 - 0 ratings

Related issues

courtneyaschwartz picture courtneyaschwartz  路  6Comments

navin11 picture navin11  路  4Comments

Neve12ende12 picture Neve12ende12  路  3Comments

mhikhey371 picture mhikhey371  路  4Comments

sudhir600 picture sudhir600  路  9Comments