Дополнительные возможности
Проверка существования объекта и его свойств
Correct using (1):
function test (a) {
alert(isDefined(a) ? "true" : "false")
}
test(1);
test(0);
test();
Correct using (2):
var x = {a:0};
alert(isDefined(x,"a") ? "true" : "false");
alert(isDefined(x,"b") ? "true" : "false");
Not correct using:
alert(isDefined(x.b) ? "true" : "false");