如果我的变量已定义,我需要设置一个值,而不是 null 并且等于 "" 或其他任何值。
我正在使用以下内容:
if (typeof abc != 'undefined') {
if (abc != null) {
// Here the variable abc must be defined
// not null
// equal to "" or anything else such as a longer string or number
}
}
有人可以告诉我这是否是我实施所需检查的最佳方式。