是否有& amp;Javascript中的逻辑运算符 [英] Is there a & logical operator in Javascript

查看:64
本文介绍了是否有& amp;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#同时接受&和double&&&&&&<   效率更高,因为一旦遇到错误,它将退出比较循环,但是我无法找到有关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.

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

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