+2
А якщо в ф-ії перевизначити undefined? Чи тепер до кожної ф-ії додавати зайвий параметер?

Краще так

function surelyUndefined(undefined)
{
	return undefined;
}

var container = { a : 0 };

console.log(container.a == surelyUndefined());
console.log(container.b == surelyUndefined());


або навіть

function isDefined(variable, undefined)
{
    return variable != undefined;
}

var container = { a : 0 };

console.log( isDefined(container.a));
console.log( isDefined(container.b));

avatar

xaos

  • 17 січня 2011, 19:51