Create, get, delete cookie Javascript

With tons of information out there I searched for way to long to find out how to do basic cookie manipulation in Javascript / jQuery, so here goes:

Create/Set cookie

function createCookie(name, value, days) {
  var expires = "";
  if (days) {
    var date = new Date();
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    expires = "; expires=" + date.toUTCString();
  }
  document.cookie = name + "=" + (value || "") + expires + "; path=/";
}

Get/Retrieve cookie

function getCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for (var i = 0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0) == ' ') c = c.substring(1, c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
  }
  return null;
}

Delete/Erase cookie

function deleteCookie(name) {
	createCookie(name,"",-1);
}

To delete a cookie, simply set is expiry date to something in the past. Hence the -1