1

A friend asked me this question he got during a job interview

function canbetrue(x) {
return x != x;
}

Which value of param will make the above function return true ?

console.log(canbetrue(param));
TSR
  • 17,242
  • 27
  • 93
  • 197

1 Answers1

6

NaN is what you are looking for...

function canbetrue(x) {
return x != x;
}
console.log(canbetrue(NaN));
Sudhir Ojha
  • 3,247
  • 3
  • 14
  • 24