Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6156569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:38:04+00:00 2026-05-23T20:38:04+00:00

If I get Chrome to show me document.cookie by going into the console and

  • 0

If I get Chrome to show me document.cookie by going into the console and typing document.cookie; it’ll give me, say:

"name=John; gender=male";

But then if I type in, say, document.cookie = 5; all it does is add 5; to the start of the string, so I get:

"5; name=John; gender=male";

If I try document.cookie = null; then it doesn’t even do anything.

How can this be? It’s a variable, isn’t it? So why isn’t the assignment operator working the way it should? Is it actually just a bit of syntactic sugar rather than a real variable? And if so, what precisely is the sugar covering up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:38:05+00:00Added an answer on May 23, 2026 at 8:38 pm

    document.cookie has very special behavior. As you’ve seen, assigning to it adds (or updates) a cookie (or multiple cookies), rather than replacing all of the cookies. It’s very unusual.

    Read all about it on MDN.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My jQuery code: $(document).ready(function() { chrome.extension.sendRequest({get: height}, function(response) { height = response.value; }); $(#id).css(height,
I get this behavior in both Chrome (Developer Tools) and Firefox (Firebug). Note the
Sometimes I get a broken background in Chrome. I do not get this error
I'm trying to get HTML5's audio tag to work in Chrome. The following code
I am trying to get the .focus() working in IE, it works in chrome
In the Google Chrome debugger, I often want to get a reference to a
When I window.open( http://blarg ) in chrome, I get a new tab. If I
I am a beginner with chrome extension. In my content_script.js, how can a get
I'm trying to access some custom data emitted into an SVG document by Visio
In my popup.html in my chrome extension I have a button that will get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.