alert(Boolean(4));//true
alert(Boolean(0));//false
if ((x = 4)) {
alert(Boolean(x));//true
}
if (!(x = 0)) {
alert(Boolean(x));//false
}
let x = 4;
if (x) {
alert(Boolean(x)); //true
}
x = 0;
if (!x) {
alert(Boolean(x)); //false
}
if (4) {
alert(Boolean(4));//true
}
if (!0) {
alert(Boolean(0));//false
}
if(x && !isNaN(x) && x=4){
alert("true");
} else {
x = 0;
alert("false");
}
能再明确一下要求吗
你这代码本来就有问题x声明了三遍
if(x==0||isNaN(x)){
x=false
}else{
x=true;
}