In JavaScript, what happens if “delete” a property that doesn’t exist?

Nothing happens.

Assuming, x = {}, Type(x.y) is not a Reference Specifcation Type (there cannot be a “reference” to a property that does not exist). According to 11.4.1 The delete Operator, this satisfies the rule:

  1. Let ref be the result of evaluating UnaryExpression.
  2. If Type(ref) is not Reference, return true.

This behavior (of “no action”) has existed for a long time – any environment that behaves differently is non-compliant. From the 3rd Edition ECMAScript Specification:

When the [[Delete]] method of O is called with property name P, the following steps are taken:

  1. If O doesn’t have a property with name P, return true.
  2. ..

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)