Check if a object's property exists.
in is used to check if an object contains a specific property , this is rappresented by a string.
var obj={a:1,b:2}
// in
console.log('a' in obj); // true
console.log('c' in obj); // false
Said that.. there is a faster/shorter way to do that.
// this does not work if the property's value is 0,null,undefined,false...
console.log(!!obj.a); // true
console.log(!!obj.c); // false
demo
http://jsfiddle.net/cLDEd/
in your case a better solution would be:
var H=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight
or even better :
var H=window.innerHeight||document.documentElement.offsetHeight
Theoretically window.innerHeight could be 0 , so at that point it would try to get the document.documentElement.offsetHeight whitch returns undefined and you should add another or ||0 to return 0 and not undefined. But that does not happen ;).
Putting window.innerHeight in front of document.documentElement.offsetHeight accelerates the check as window.innerHeight is standard, so there is a higher chance that it's the correct choice.