有没有& Javascript中的逻辑运算符 [英] Is there a & logical operator in Javascript

查看:106
本文介绍了有没有& Javascript中的逻辑运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有& Javascript中的逻辑运算符。我试过跑1& 0和1&&在Firebug(Firefox)中为0,两者都返回0。

I was wondering if there is a "&" logical operator in Javascript. I tried running 1 & 0 and 1 && 0 in Firebug(Firefox) and it returned a 0 for both.

有人告诉我C#接受& amp;和double&&,&,double会更有效率,因为它会在遇到false时立即退出比较循环,但我无法在其上找到Javascript的任何信息。

Someone told me that C# accepts both & and double &&, double being more efficient as it will exit the comparison loop as soon as a false is encountered, but I was not able to find any info for Javascript on that.

任何想法?

推荐答案

没有。 & 按位AND 运营商。 && 是Javascript中唯一的逻辑AND运算符。

No. & is a bitwise AND operator. && is the only logical AND operator in Javascript.

这篇关于有没有& Javascript中的逻辑运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆