否运算符(按位非):~ 加1取反
console.log(~-11); //10 console.log(~-1); //0 console.log(~0); //-1
void():计算表达式,但是不返回值(仅仅是不返回值,但是括号内的表达式还是要运行的)
<a href="javascript:void(0)">单击此处什么也不会发生</a> <a href="javascript:void(alert(‘Warning!!!‘))">点我!</a> function getValue(){ var a,b,c; a = void ( b = 5, c = 7 ); document.write(‘a = ‘ + a + ‘ b = ‘ + b +‘ c = ‘ + c ); } //a = undefined b = 5 c = 7
原文地址:https://www.cnblogs.com/qq254980080/p/9787187.html
时间: 2024-10-15 07:43:28