我在一个项目中找到了这行代码,下不了
return d.isPointInside(a, b) ? (console.log("runned"), c = !0, !1) : void 0
我无法理解的部分:
(console.log("runned"), c = !0, !1)
“已运行”一词应该显示在浏览器的控制台中,但需要一些帮助才能理解其余部分。
最佳答案
只是一些类型的杂耍
!0 === true
!1 === false
void 0 === undefined
一些较长单词的结果:
(console.log("runned"), c = true, false);
完整的返回语句如下,没有使用 Comma Operator :
if (d.isPointInside(a, b)) {
console.log("runned");
c = true;
return false;
} else {
return undefined;
}
关于JavaScript怪异的赋值代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39315233/