JavaScript_数据类型在if条件判断中的真与假

  1. Number:0为false,非0为true
  2. String:""为0、false,非空字符串为true
  3. Boolean: true为true,false为false
  4. Object:true
  5. Undefined/NaN/null: false
发布了359 篇原创文章 · 获赞 26 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/Chill_Lyn/article/details/104115338