jsfunction fnc() { console.log("x"); fnc = function() { console.log("y"); } } fnc()//x fnc()//y fnc()//y
jsconsole.log([undefined, null, "",0,false,NaN,1,2].filter(Boolean)) //[1,2]
可判断类型:undefined、null、string、number、boolean、array、object、symbol、date、regexp、function、asyncfunction、arguments、set、map、weakset、weakmap
jsfunction DataType(tgt, type) { const dataType = Object.prototype.toString.call(tgt).replace(/\[object (\w+)\]/, "$1").toLowerCase(); return type ? dataType === type : dataType; }
cssoverflow: hidden; text-overflow:ellipsis; white-space: nowrap;
cssdisplay: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
css
false或0 不执行
false||'a'
0||'a'
false&&'a'
0&&'a'
//元素不会占用空间,在页面中不显示,子元素也不会显示。
display: none;
//元素隐藏,但元素仍旧存在,占用空间,页面中无法触发该元素的事件。
visibility: hidden;
//元素透明度将为0,但元素仍然存在,绑定的事件仍旧有效仍可触发执行。
opacity: 0;