gpt4 book ai didi

javascript - 如何将 = 字符更改为 "with the value"

转载 作者:行者123 更新时间:2023-12-02 17:28:18 26 4
gpt4 key购买 nike

我从另一个问题中得到了这个:

document.getElementById('value').innerHTML=listCookies()
function listCookies() {
var theCookies = document.cookie.split(';');
var aString = '';
for (var i = 1 ; i <= theCookies.length; i++) {
aString += ' ' + theCookies[i-1] + "\n";
}
return aString;
}

它会说:

cookie=value

我怎样才能做到这样:

cookie with the value 4

最佳答案

function listCookies() {
var theCookies = document.cookie.split(';');
var aString = '';
for (var i = 0 ; i < theCookies.length; i++) {
aString += ' ' + theCookies[i].replace('=', ' with the value ') + "\n";
}
return aString;
}

关于javascript - 如何将 = 字符更改为 "with the value",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23320933/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com