SOURCE

// 设置cookie
function setCookie(name, value, days, domain) {
  // var Days = 1;
  var exp = new Date();
  exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1000);
  var cook = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
  if (domain) {
    cook += ';domain=' + domain
  }
  document.cookie = cook
  return cook
}

console.log(new Date().getTime())

// 读取cookie
function getCookie(name) {
  var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
  if (arr = document.cookie.match(reg)) return unescape(arr[2]);
  else return null;
}
console 命令行工具 X clear

                    
>
console