Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get cookie in javascript

function getCookie(cookie, name) {
  const q = {}
  cookie?.replace(/s/g, '')
    .split(';')
    .map(i=>i.split('='))
    .forEach(([key, value]) => {
      q[key] = value
    })
  return q[name]??null;
}
 
PREVIOUS NEXT
Tagged: #cookie #javascript
ADD COMMENT
Topic
Name
8+4 =