Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

parse document.cookie

const parseCookie = str =>
  str
  .split(';')
  .map(v => v.split('='))
  .reduce((acc, v) => {
    acc[decodeURIComponent(v[0].trim())] = decodeURIComponent(v[1].trim());
    return acc;
  }, {});
  
// cookie in browser: `pkg=math; equation=E%3Dmc%5E2`
parseCookie(document.cookie);
//console: { pkg: 'math', equation: 'E=mc^2' }
Comment

PREVIOUS NEXT
Code Example
Javascript :: if array is empty jquery 
Javascript :: axios node js set user agent 
Javascript :: jquery script tag source google 
Javascript :: js post 
Javascript :: js remove undefined from array 
Javascript :: get last day of month typescript 
Javascript :: yup email validation 
Javascript :: java.lang.outofmemoryerror (no error message) react native 
Javascript :: skip import angular 6 
Javascript :: how to generate a random number in javascript 
Javascript :: javascript get random number in range 
Javascript :: javascript check if string is json parsable 
Javascript :: sort array by date moment 
Javascript :: set select option as selected jquery 
Javascript :: javascript repeat each second 
Javascript :: grafana labs node exporter 
Javascript :: jquery click or touch 
Javascript :: open link in new tab jquery 
Javascript :: disable console log alert eslint 
Javascript :: get value onChange from mat-select angular 
Javascript :: js new line regex 
Javascript :: javascript split get last element 
Javascript :: javascript uppercase first character of each word 
Javascript :: javascript live time 
Javascript :: react native build android apk 
Javascript :: nodejs get file size 
Javascript :: uncheck all radio button jquery 
Javascript :: node js fetch 
Javascript :: javascript get length of object 
Javascript :: add jquery to project 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =