title: Set Cookie Path JavaScript
body: <p>I want the code below to set the path to root, I understand I have to set / as the path value however this is not my code and I am not familiar with Javascript!</p>
  
  <pre><code>function setCookie(name, value, expires, path, domain, secure){
  
  document.cookie= name + "=" + escape(value) +
  ((expires) ? "; expires=" + expires.toGMTString() : "") +
  ((path) ? "; path=" + path : "") +
  ((domain) ? "; domain=" + domain : "") +
  ((secure) ? "; secure" : "");
  }
  </code></pre>
  
  <p>I have tried editing the code as below but have been unsuccessful.</p>
  
  <pre><code> setCookie(name, value, expires, path, domain, secure){
  
  document.cookie= name + "=" + escape(value) +
  ((expires) ? "; expires=" + expires.toGMTString() : "") +
  ((path) ? "; path="/") +
  ((domain) ? "; domain=" + domain : "") +
  ((secure) ? "; secure" : "");
  }
  </code></pre>