+ -
当前位置:首页 → 问答吧 → 请问下列语句是如何运算的?

请问下列语句是如何运算的?

时间:2011-11-27

来源:互联网

JS的:

1. p == "relative" || p == "absolute" || (this._container.style.position = "relative");

2. index < 0 && (index = this._count - 1) || index >= this._count && (index = 0);

3. index == undefined && (index = this.Index);这句的效果是不是判断index是undefined的时候使用this.Index?还是Bool?

求高手解答

作者: tygfr2011   发布时间: 2011-11-27

1, 当p等于relative或者等于absolute的时候才执行this._container.style.position = "relative"这句

2,当 index 小于0的时候执行index = this._count - 1,执行完index = this._count - 1之后判断index 如果大于等于this._count则执行index = 0

3,index等于undefined 的时候执行index = this.Index

作者: liangws   发布时间: 2011-11-27

index = this.Index 先赋值
&& 后面要求是布尔值,js中0 null undefined可自动转为布尔值false,其他值比如非0数字,非空字符串,对象等自动转成true,所以 可以 && index

作者: hookee   发布时间: 2011-11-27

相关阅读 更多

热门下载

更多