admin管理员组文章数量:1342902
I found some code using
!0
!1
I guess this is just the same things than
true
false
is there a reason for doing that or is just some abbreviation?
I found some code using
!0
!1
I guess this is just the same things than
true
false
is there a reason for doing that or is just some abbreviation?
Share asked Mar 25, 2013 at 14:39 PaoloPaolo 2,4726 gold badges34 silver badges45 bronze badges 6- 5 Find who wrote that code and make a note not to hire him or her for any future work. :-) – Pointy Commented Mar 25, 2013 at 14:40
- 1 I would guess it's mainly for obfuscation/uglification. – Reinstate Monica -- notmaynard Commented Mar 25, 2013 at 14:42
- 3 @Pointy This code is produced by JavaScript Closure Compiler, as an example. Is it a time to fire it? ;) – VisioN Commented Mar 25, 2013 at 14:42
- @VisioN Ha ha! Well then that makes perfect sense I guess. – Pointy Commented Mar 25, 2013 at 14:44
- In JS it make sense, it can save some loading time. But its definetely ugly :-) – Gatekeeper Commented Mar 25, 2013 at 14:44
1 Answer
Reset to default 17If you really care about bandwidth and loading time then you need code pression. !0
and !1
is a pressed version of true
and false
.
本文标签: javascriptAny reason to use 0 instead of trueStack Overflow
版权声明:本文标题:javascript - Any reason to use !0 instead of true? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743683180a2521463.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论