Skip to content

Instantly share code, notes, and snippets.

@romuleald
Created May 1, 2017 17:28
Show Gist options
  • Save romuleald/1b2f7bd22f595ff89cd4c2315a4f07e8 to your computer and use it in GitHub Desktop.
Save romuleald/1b2f7bd22f595ff89cd4c2315a4f07e8 to your computer and use it in GitHub Desktop.
getCookies with reduce
var getCookies = function(){
document.cookie.split(';').reduce(function(acc, curr, arr){
let _split = curr.split('=');
acc[_split[0].trim()] = _split[1];
return acc;
},{})
};
@bbecquet
Copy link

bbecquet commented May 1, 2017

Je pense que t'as oublié le return global devant l'instruction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment