Created
May 1, 2017 17:28
-
-
Save romuleald/1b2f7bd22f595ff89cd4c2315a4f07e8 to your computer and use it in GitHub Desktop.
getCookies with reduce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getCookies = function(){ | |
document.cookie.split(';').reduce(function(acc, curr, arr){ | |
let _split = curr.split('='); | |
acc[_split[0].trim()] = _split[1]; | |
return acc; | |
},{}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Je pense que t'as oublié le
return
global devant l'instruction.