这个感叹号在Javascript中意味着什么? [英] What does this exclamation mark mean in Javascript?
本文介绍了这个感叹号在Javascript中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
function F() {
w = !0;
return !1
}
这是设置布尔值的特殊方法吗?变量?为什么作者会这样做?
Is this a special way of setting a boolean variable? Why did the author do this?
编辑:上下文:
document.onmousedown = F;
推荐答案
这是一个不必要的实力的例子。下面的代码完全相同:
This is an example of unnecessary prowess. The code below is exactly the same:
function F() {
w = true; //w = !0;
return false //return !1
}
如果您使用的是你应该在生产中使用优秀的缩小工具,聪明的编程可以节省几个字节。
If you are using a good minification tool, which you should in production, clever programming to save a few bytes becomes unnecessary.
这篇关于这个感叹号在Javascript中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文