请问下列语句是如何运算的?
时间: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?
求高手解答
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
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
&& 后面要求是布尔值,js中0 null undefined可自动转为布尔值false,其他值比如非0数字,非空字符串,对象等自动转成true,所以 可以 && index
作者: hookee 发布时间: 2011-11-27
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28