javascriptecmascript-2021

What is the difference between a 'standard object' and an 'ordinary object' in ECMAScript?


Within the Terms and Definitions section of ECMAScript 2021 Language Specification, an ordinary object is defined as:

object that has the default behaviour for the essential internal methods that must be supported by all objects

A standard object is defined as:

object whose semantics are defined by this specification

After reading both definitions, I immediately asked myself, "Isn't the default behavior of the essential internal methods that must be supported by all objects also defined in this specification?"

I've tried searching the specification for both terms, but there are over 100 matches for 'ordinary object' and only a handful of references for 'standard object', which didn't provide additional context that made the distinction between these terms clear to me. I've also tried Google searching and none of the results seem relevant to my question.

What is the difference between an ordinary object and a standard object? What is an example of a scenario in which it is useful to distinguish between between these two types of objects?


Solution

  •  const user = { firstname: "Jonas" };
    

    That's an ordinary object (as it is not exotic), however it is not a standard object, as the semantics are defined by me and not by the specification. Its behavior, however, is specified (e.g. user.firstname will evaluate to "Jonas").