js小知识 双叹号(!!)
2024-08-31 10:20:02
!!:一般用来将后面的表达式强制转换为布尔值(boolean):true或者false;
avascript约定规则为:
false、undefinded、null、0、”” 为 false
true、1、”somestring”、[Object] 为 true
所以:
!false !undefinded !null !0 !"" 为true
!!false !!undefinded !!null !!0 !!"" 为false
!true !1 !"somestring" ![Object] 为false
!!true !!1 !!"somestring" !![Object] 为true
最新文章
- 对比Haproxy和Nginx负载均衡效果
- php 时间加减
- Xcode6 storyboard new push segue 后的视图控制器没有navigation item bug.
- linux---mysql安装
- ABAP 加密解密程序
- Spring MVC3返回JSON数据中文乱码问题解决(转)
- BZOJ [ZJOI2008]泡泡堂BNB 贪心
- Zepto源码笔记(三)
- Twisted No module named win32api
- react基础(2)
- Codefroces 850C Arpa and a game with Mojtaba
- 优秀设计师应当知道的20大UI设计原则
- Appium could not connect to server are you sure it's running appium desktop
- 发布自己的类库到NuGet
- 关于npm的坑
- django session 的简单操作
- Docker容器管理及代码调用
- windows10 下安装tensorflow 并且在jupyter notebook 上使用tensorflow
- vue 之 Vue.extend()
- form表单转化json对象