请问高手,这句是什么意思呢?

zjj2002 2003-01-24 01:09:00
x = bw.ie && document.body.offsetWidth-20||innerWidth||0;
...全文
36 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xizi2002 2003-01-24
  • 打赏
  • 举报
回复
执行先后为not and or
<script>
x = 0 && 100||1||10;
alert(x);
</script>
zjj2002 2003-01-24
  • 打赏
  • 举报
回复
wsj(骆驼), 谢谢你的回答!
我想问的是整个表达式的意思?这么说吧!
如果bw.ie,document.body.offsetWidth-20存在,innerWidth不存在,
那么X的返回值是谁?当然,你一试就知道!我不明白的是结果是怎么的出来的?
wsj 2003-01-24
  • 打赏
  • 举报
回复
JScript Language Reference

--------------------------------------------------------------------------------

Logical AND Operator (&&)
Performs a logical conjunction on two expressions.

result = expression1 && expression2

Arguments
result

Any variable.

expression1

Any expression.

expression2

Any expression.

Remarks
If, and only if, both expressions evaluate to True, result is True. If either expression evaluates to False, result is False.

JScript uses the following rules for converting non-Boolean values to Boolean values:

All objects are considered true.
Strings are considered false if, and only if, they are empty.
null and undefined are considered false.
Numbers are false if, and only if, they are zero.
Requirements
Version 1

wsj 2003-01-24
  • 打赏
  • 举报
回复
JScript Language Reference

--------------------------------------------------------------------------------

Logical OR Operator (||)
Performs a logical disjunction on two expressions.

result = expression1 || expression2

Arguments
result

Any variable.

expression1

Any expression.

expression2

Any expression.

Remarks
If either or both expressions evaluate to True, result is True. The following table illustrates how result is determined:

If expression1 is And expression2 is The result is
True True True
True False True
False True True
False False False


JScript uses the following rules for converting non-Boolean values to Boolean values:

All objects are considered true.
Strings are considered false if and only if they are empty.
null and undefined are considered false.
Numbers are false if, and only if, they are 0.
Requirements
Version 1

eumcsdn 2003-01-24
  • 打赏
  • 举报
回复
不知道什么意思,我不是高手。

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧