11.4.1 delete operator

2010-05-16

UnaryExpression : delete UnaryExpression

Code: (Meta Ecma)
function evaluate(delete UnaryExpression) {
var ref = evaluate(UnaryExpression);
if (Type(ref) != 'reference') return true; // no such property
if (IsUnresolvableReference(ref)) {
if (IsStrictReference(ref)) throw SyntaxError;
return true; // property doesn't exist...
}
if (IsPropertyReference(ref)) return ToObject(GetBase(ref)).[[Delete]](GetReferencedName(ref), IsStrictReference(ref));
// ref is environment record binding
if (IsStrictReference(ref)) throw SyntaxError;
var bindings = GetBase(ref);
return bindings.DeleteBinding(GetReferencedName(ref));
}

Basically, a SyntaxError is thrown when you try to delete a variable, function or function argument directly (so not when removing a property of an object, but from the current lexical environment). Additionally, a TypeError is thrown when in strict mode and the property has the attribute [[Configurable]] set to false.

See also DeleteBindings and [[Delete]].