{"size": 527, "ext": "js", "max_stars_repo_path": "shopping-cart/src/script/cookie.js", "max_stars_repo_name": "yyjmstar/jQuerycase", "max_stars_repo_stars_event_min_datetime": "2021-08-12T17:11:21.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-12T17:11:21.000Z", "max_issues_repo_path": "shopping-cart/src/script/cookie.js", "max_issues_repo_name": "yyjmstar/jQuerycase", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "shopping-cart/src/script/cookie.js", "max_forks_repo_name": "yyjmstar/jQuerycase", "max_forks_repo_forks_event_min_datetime": "2020-06-11T05:18:24.000Z", "max_forks_repo_forks_event_max_datetime": "2020-06-11T05:18:24.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 23.9545454545, "max_line_length": 55, "alphanum_fraction": 0.569259962}
//1.设置cookie 
function setcookie(key, value, time) {
    let date = new Date();
    date.setDate(date.getDate() + time);
    document.cookie = `${key}=${value};expires=${date}`
};

//2.获取cookie
function getcookie(key) {
    let arr = decodeURI(document.cookie).split('; ');
    for (let i = 0; i < arr.length; i++) {
        let newarr = arr[i].split('=');
        if (newarr[0] === key) {
            return newarr[1]
        }
    }
}

//3删除cookie:将要删除的cookie的时间设置成过去的时间
function delcookie(key) {
    setcookie(key, '', -1)
}