Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

191
Visualizações
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?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Yes, every ordinary object is also a standard object.

The term ordinary object is contrasted with an exotic object, which does have non-default implementations of the internal object methods. Examples of standard exotic objects are proxies, arrays and bound functions.

The term standard object (previously also known as "native object", which led to a lot of confusion) is contrasted with a host object or implementation-defined object, which are specified by a different specification (e.g. HTML5) or implemented in the engine without a formal specification. These can be functions (that are otherwise ordinary) with a host-defined call behaviour (e.g. console.log, setTimeout etc) or totally exotic objects (document.all, nodelists, etc) - see web APIs for an overview of browser-defined objects. Other environments will provide other host-defined objects.

Ordinary objects (with standard, default behavior) whose existence is governed by the host implementation or non-ECMAScript standard may be classified as either, I guess.

Just for reference, the last distinction that is relevant for this terminology discussion is between built-in objects (also builtins) and user-defined objects. The former are created by the implementation at startup, providing the environment that user code can interact with. The latter are constructed by user code at runtime. It does unfortunately become a grey area when exotic objects are constructed by native (non-user) code, these are sometimes called "built-in" as well.

See also What is the difference between native objects and host objects? and In ECMAScript, how are some of native objects also built-in?.

about 4 years ago · Juan Pablo Isaza Relatório

0

 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").

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda