You cannot pass a variable that does not exist ( undefined , not null ... which exists) to a function, it tries to get the value foo to pass it when you call
var test = peachUI().stringIsNullOrEmpty(foo);
... and it is not there, so you get an error only on this line, as in the case with a simpler case:
alert(foo);
Now, if you tried to name it as a property of something, then it will be valid, for example:
alert(window.foo);
It is then passed undefined because this property is undefined on a known / real object.
Nick craver
source share