True和False不能写成ture和false,不然会报错 not not True or False and not True 按照not>and>or来进行括号 (not (not True)) or (False and (not True)) or:有真为真,前面是真,后面就不用管了,成为短路原则…
1.判断问题 如果type存在就设置type的值为type,否则设置type为0: 原始的写法,使用 if else:if(type){type = type} 使用三元操作符:type : type ? type : 0 使用"或": type : type || 0 · if(a){alert('ok')} 等价于 a && alert('ok') 2. && 和 || 例子: var a = 2; var b = 3; var andflag =…