!!( " ")
!!("")
!!(undefined === null)
You probably want to test for any falsey value though. So the interviewee understanding the ToBoolean spec [0] would be what you actually want to be testing for. if (!x) {
// interviewee should be able to answer for which values of `x` this condition would run
// this shows they understand which values are falsey and which values are truthy
}
The knowledge being tested would be "the same" but in a different, and I feel more direct, way. I felt your test was testing their knowledge of implicit conversion and not truthy/falsey values, so I wrote purposefully confusing code that uses implicit conversion."If everyone can easily understand what's going on, there's no harm writing code like that!" /s
[0] http://www.ecma-international.org/ecma-262/6.0/index.html#se...