From a design perspective, it's hard to say what the appropriate return value of k in null
should be (true
is clearly wrong, but false
is misleading), but it's easy to say that in the for-in
statement, you should just skip the loop.
I don't agree with this decision at all - I think that for (k in null)
should throw an error, especially if running in strict mode. But you can see how the difference would arise.