let a = undefined;
let b = null;
let c = '';
let d = ;
let e = {};
let f = [];
if (a) {
console.log("undefined 能过");
} else {
console.log("undefined 不能过");
}
if (b) {
console.log("null 能过");
} else {
console.log("null 不能过");
}
if (c) {
console.log(" '' 能过");
} else {
console.log(" '' 不能过");
}
if (d) {
console.log("0 能过");
} else {
console.log("0 不能过");
}
if (e) {
console.log("{} 能过");
} else {
console.log("{} 不能过");
}
if (f) {
console.log("[] 能过");
} else {
console.log("[] 不能过");
} [-- ::51.835] [INFO] console - undefined 不能过
[-- ::51.836] [INFO] console - null 不能过
[-- ::51.837] [INFO] console - '' 不能过
[-- ::51.838] [INFO] console - 不能过
[-- ::51.844] [INFO] console - {} 能过
[-- ::51.849] [INFO] console - [] 能过 原文:https://blog.csdn.net/baidu_37379451/article/details/82380836

随机推荐

  1. Windows Internals 笔记——线程

    1.进程有两个组成部分,一个进程内核对象和一个地址空间.线程也有两个组成部分: 一个是线程的内核对象,操作系统用它管理线程.系统还用内核对象来存放线程统计信息的地方. 一个线程栈,用于维护线程执行时所 ...

  2. TortoiseGit安装使用简单教程

    一.简介 TortoiseGit是Tortoise基于git的可视化管理工具.本文即将介绍这个工具的安装和简单使用教程(本文均是基于Windows 64位操作系统). git的管理工具有很多.Tort ...

  3. python 10大算法之一 LinearRegression 笔记

    简单的线性回归预测房价 #!/usr/bin/env python # encoding: utf-8 """ @version: @author: --*--. @fi ...

  4. LeetCode 709.To Lower Case

    Description Implement function ToLowerCase() that has a string parameter str, and returns the same s ...

  5. UVA 548 Tree 建树

    题意: 输入中序和后序的权值,输出哪个叶子使它到根的路径上权和最小. 思路: 输入后建树,然后dfs求最小的叶子. #include<iostream> #include<cstdi ...

  6. java动态代理实现与原理详细分析

    关于Java中的动态代理,我们首先需要了解的是一种常用的设计模式--代理模式,而对于代理,根据创建代理类的时间点,又可以分为静态代理和动态代理. 一.代理模式    代理模式是常用的java设计模式, ...

  7. window.open 打开全屏窗口

    window.open新打开页面为全屏状态,各个浏览器情况不一致. window.open   弹出新窗口的命令:     'page.html'   弹出窗口的文件名:     'newwindow ...

  8. BZOJ.4598.[SDOI2016]模式字符串(点分治 Hash)

    LOJ BZOJ 洛谷 点分治.考虑如何计算过\(rt\)的答案. 记\(pre[i]\)表示(之前的)子树内循环匹配了\(S\)的前缀\(i\)的路径有多少,\(suf[i]\)表示(之前的)子树内 ...

  9. 英语口语练习系列-C39-舞蹈-谈论昨天的活动

    词汇-舞蹈(dancing) ballet body shaking sway the body have a good figure special training arm movement da ...

  10. Android中的Application类在应用程序中的应用

    Application类 每次应用程序运行时,应用程序的Application类都保持实例化状态(都会持有该Application实例).与Activity不同的是,配置改变并不会导致应用程序重启.在 ...