简体   繁体   English

相当于 JavaScript 中的 和 ?

[英]Equivalent of and in JavaScript?

What's the equivalent of and in JS because I can't seem to find an answer在 JS 中 和 的等价物是什么,因为我似乎找不到答案

}else if (i % 3 & 5 === 0){
console.log('...')

A googling for "javascript AND operator" returns a first hit of http://www.w3schools.com/js/js_comparisons.asp which clearly explains the answer:谷歌搜索“javascript AND 运算符”返回http://www.w3schools.com/js/js_comparisons.asp的第一个命中,它清楚地解释了答案:

if (i % 3 && 5 === 0)

This is the answer you're looking for, but given how it's written, it might not give you the outcome you expect depending on execution.这是您正在寻找的答案,但考虑到它的编写方式,它可能无法根据执行情况为您提供预期的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM