IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    有个js基础的问题求解惑

    artisan发表于 2017-05-24 06:57:51
    love 0
    if([]){
    	console.log(1)
    }
    if([]==false){
    	console.log(2)
    }
    if({}){
    	console.log(3)
    }
    if({}==false){
    	console.log(4)
    }
    

    输出结果为

    1
    2
    3
    

    不是很明白,第一个[]为true,那么第二个为啥[]==false为true了,但是[]===false又为false,第三个{}为true,但是{}==false又为false了



沪ICP备19023445号-2号
友情链接