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

251
Visualizações
Why Object.getOwnPropertyDescriptors() does not work when I pass the history object (which is part of the BOM) to it?

There are different objects in the browser object model (BOM) such as history, location, document, etc. I can get the property descriptors for the location and the document objects but not for the history object. Why is that so?

enter image description here

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

0

Because the history object instance has no "own" properties. All of them are inherited from its prototype, which by definition are not included in Object.getOwn[anything] functions. You will also notice that Object.getOwnPropertyNames(history) is an empty array when you run it, telling us as much.

(Unlike location or document, which are objects with defineOwnProperty steps as part of their formal instantiation specification, history is an "empty" object with fairly special handling, but following the normal rules for object instantiation)

Instead, use Object.getOwnPropertyDescriptors(Object.getPrototypeOf(history)) if you want to see its "immediate" API.

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