测试代码:

        var params1 = '';
        var params2 = null;
        var params3;
        alert(typeof params1); // string
        alert(typeof params2); // object
        alert(typeof params3); // undefined
        alert(typeof params4); // undefined

结论:

根据上述代码可得出严格意义上的js字符变量判空条件:

  if (typeof params != 'undefined' && params != null && params != '');

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2021-11-27
  • 2022-02-10
  • 2022-12-23
猜你喜欢
  • 2021-06-11
  • 2022-01-15
  • 2022-12-23
  • 2022-02-17
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
相关资源
相似解决方案