
javascript
awwac
这个作者很懒,什么都没留下…
展开
-
javascript 数组复制
let a=[1,2,3]; const b=[...a]; // 复制 a[0]=0; console.log(a); // [0,2,3] console.log(b); // [1,2,3]原创 2019-08-08 16:57:48 · 309 阅读 · 0 评论 -
javascript if条件表达式转换规则
1.if语句会将条件表达式将会转化强制转为boolean类型,且转换时遵循下列规则: 1.Objects 转化为true 2.Undefined 转化为false 3.Null 转化为false 4.Booleans 转化为boolean的值 5.Numbers +0,-0或NaN转化为false,其他全部转化为true 6.String 空字符串为false,其他全部为true 2.看如下...翻译 2019-08-09 14:09:01 · 867 阅读 · 0 评论