我有一个案例,我检查变量是否未定义。在某些情况下,我想再次将变量变为未定义,以便它以未定义的形式返回?这会被认为是不好的做法吗?
:D/ 代码示例!
if (loc1 == undefined){
loc1 = loc.title
}
else if(loc2 == undefined){
loc2 = loc.title
}
else{
//here I want loc1 and loc2 to turn undefined again!
}
我有一个案例,我检查变量是否未定义。在某些情况下,我想再次将变量变为未定义,以便它以未定义的形式返回?这会被认为是不好的做法吗?
:D/ 代码示例!
if (loc1 == undefined){
loc1 = loc.title
}
else if(loc2 == undefined){
loc2 = loc.title
}
else{
//here I want loc1 and loc2 to turn undefined again!
}