[英]How do I put a local-storage item in an if statement?
I'm working on some code that runs a function that detects if the local storage item En
is equal to the string "English"
.我正在处理一些运行函数的代码,该函数检测本地存储项En
是否等于字符串"English"
。 Is there any way I could put En = "English"
inside the rules of an if statement?有什么办法可以将En = "English"
放在 if 语句的规则中吗? My current code:我目前的代码:
const En = "English"
document.getElementById("langEn").onclick = function() {remLangEn()};
function remLangEn() {
localStorage.setItem(lang, En);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.