![](/img/trans.png)
[英]How to check if a variable is null or empty string or all whitespace in JavaScript?
[英]How can I check if a variable is neither null or the empty string with javascript?
我一直在做以下事情:
if (json.RowKeyNew != "") {
updateGridMeta(entity, json.PartitionKey, json.RowKeyNew, row, tab);
}
但是,如果json.RowKeyNew为null,则满足if条件,这不是我想要的。 如何检查不为null且不是“”的内容?
if (json.RowKeyNew != undefined && json.RowKeyNew != "") {};
尝试...
if (json.RowKeyNew) {
updateGridMeta(entity, json.PartitionKey, json.RowKeyNew, row, tab);
}
if (json.RowKeyNew)
只是将varible放入if条件中,如果具有某些值,则返回true,否则返回false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.