JavaScript/逻辑运算:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
创建页面,内容为“== 引言 == == true 和 false == {{leftrightflex|<syntaxhighlight lang="javascript"> false && false; true && true; true && false; false && true; false || false; tru…”
 
Kangkk​(留言 | 贡献)
小 文字替换 -“{{leftrightflex|”替换为“{{Double-columns|”
 
(未显示同一用户的2个中间版本)
第1行: 第1行:
== 引言 ==
== 引言 ==
== true 和 false ==
== true 和 false ==
{{leftrightflex|<syntaxhighlight lang="javascript">
{{Double-columns|<syntaxhighlight lang="javascript">
false && false;
false && false;
true && true;
true && true;
第22行: 第22行:
false
false
true
true
</pre>
</pre>}}}}
== 有待思考 ==
{{Double-columns|<syntaxhighlight lang="javascript">
0 || true
0 && true
1 || true
1 && true</syntaxhighlight>|{{consoleout|<pre>
true
0
1
true
</pre>}}}}
同样在 python 里也是这样,我猜测 0 在计算机里有特殊的含义

2026年11月26日 (四) 06:16的最新版本

引言

true 和 false

false && false;
true && true;
true && false;
false && true;
false || false;
true || true;
true || false;
false || true;
false && (false || true);
(false && false) || true;
false
true
false
false
false
true
true
true
false
true

有待思考

0 || true
0 && true
1 || true
1 && true
true
0
1
true

同样在 python 里也是这样,我猜测 0 在计算机里有特殊的含义