title: Setting up cookie in Javascript (Angular): Issues with semicolon
body: <p>I was trying to set up cookies with TypeScript in Angular, when I encountered a seemingly weird problem.</p>
  
  <p>I just wanted to store some information in a cookie for later use (testing purposes only). All I did was execute this line:</p>
  
  <pre><code>document.cookie = "token=" + value + "; expires=" + date + ";";
  </code></pre>
  
  <p>If I execute <code>document.cookie</code> afterwards however the result is as follows:</p>
  
  <pre><code>"Cookie: token=_value_"
  </code></pre>
  
  <p>I would expect the result to be: </p>
  
  <pre><code>"Cookie: token=_value_; expires=_date_;"
  </code></pre>
  
  <p>It just erases everything after the semicolon in the string. If I change them to commas instead everything gets concatenated correctly.
  So there has to be some problem with semicolons? But in every "tutorial" for cookies they use this grammar. 
  I tried many things like encoding semicolon values and what not. I'm sure there is a simple answer to this?</p>