gpt4 book ai didi

javascript - 是什么 ??! Javascript 中的运算符?

转载 作者:行者123 更新时间:2023-11-30 06:56:58 27 4
gpt4 key购买 nike

当我在寻找一些站点的 Javascript 代码时,我看到了这个

function hrefLeftMenu() {
var x = true;
for (i in info) {
$(".leftmenu ul").append("<li" + (x ? " class='active'" : "") + " onclick='openAnInfo(\"" + i + "\", this);'> - " + info[i].title + "</li>");
x = x??!x;
}
openAnInfo("0", ".lelelesakineyy");
}

它在 javascript 中的作用是什么?为什么编码人员使用此运算符?

谢谢。

最佳答案

What it does in javascript?

它抛出一个语法错误。

> x = x??!x;
SyntaxError: Unexpected token ?

Why the coder's used this operator?

做出合理的猜测(除了“他们犯了一个错误”)需要更多的背景信息。肯定地说需要读心术:)

关于javascript - 是什么 ??! Javascript 中的运算符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12196896/

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