Javascript 这个函数能返回真值吗?canbetrue(x){return x!=x;}

Javascript 这个函数能返回真值吗?canbetrue(x){return x!=x;},javascript,Javascript,一个朋友问我这个问题,他是在一次工作面试中得到的 function canbetrue(x) { return x != x; } param的哪个值将使上述函数返回true console.log(canbetrue(param)); 你要找的就是NaN 函数canbetrue(x){ 返回x!=x; } console.log(坎伯鲁(南))NaN是您正在寻找的 函数canbetrue(x){ 返回x!=x; } console.log(坎伯鲁(南))如果x==false,则函数返回

一个朋友问我这个问题,他是在一次工作面试中得到的

function canbetrue(x) {
return x != x;
}
param
的哪个值将使上述函数返回true

console.log(canbetrue(param));

你要找的就是NaN

函数canbetrue(x){
返回x!=x;
}

console.log(坎伯鲁(南))NaN是您正在寻找的

函数canbetrue(x){
返回x!=x;
}

console.log(坎伯鲁(南))如果x==false,则函数返回true@Osama不,是的not@Osama你错了,看哪!是如果它返回true,它将是x=!x;他们必须解析NaN才能返回true。看看它是否返回false?如果x!=x始终为false如果x==false,则函数返回true@Osama不,是的not@Osama你错了,看哪!是如果它返回true,它将是x=!x;他们必须解析NaN才能返回true。看看它是否返回false?如果x!=x总是假的