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
  • 12,583
  • 19
  • 64
  • 146

1 Answers1

6

NaN is what you are looking for...

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