您现在的位置是:首页 > 电脑技术查询 > web开发

请教javascript有没有string.IsNullOrEmpty

编辑:chaxungu时间:2022-10-02 23:16:08分类:web开发

请问javascript有没有string.IsNullOrEmpty
如题,javascript有没有string.IsNullOrEmpty。如果没有,有没有什么好的代码?

先答先得分!

------解决方案--------------------
null和empty都为false
------解决方案--------------------
js更简单

c#:
if (string.IsNullOrEmpty(str)) ...

js:
if (!str) ...