Skip to content

Instantly share code, notes, and snippets.

@dsheiko

dsheiko/utils.js

Created Jan 31, 2020
Embed
What would you like to do?
Gt cookies by name with JavaScript
function getCookie( name ) {
const value = "; " + document.cookie,
parts = value.split( "; " + name + "=" );
if ( parts.length === 2 ) {
return parts.pop().split( ";" ).shift();
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment