Q:

Write a JavaScript program to serialize a cookie name-value pair into a Set-Cookie header string

0

Write a JavaScript program to serialize a cookie name-value pair into a Set-Cookie header string.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const serializeCookie = (name, val) => `${encodeURIComponent(name)}=${encodeURIComponent(val)}`;
console.log(serializeCookie('foo', 'bar'));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now