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

160
Visualizações
Not able to understand this prototype concept

I was going through an article` and I came across this code , where it was explaining about prototype, and how it works. What I want is , what does this sentence mean with respect to the code.

This code creates a Date object, then walks up the prototype chain, logging the prototypes. It shows us that the prototype of myDate is a Date.prototype object, and the prototype of that is Object.prototype

const myDate = new Date();
let object = myDate;

do {  
  object = Object.getPrototypeOf(object);
  console.log(object);

} while (object);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It’s actually quite straightforward:

const myDate = new Date();   // Create a Date object.
let object = myDate;

do {  
  object = Object.getPrototypeOf(object); // Find the object’s prototype.
  console.log(object);                    // Print to the log.
} while (object);            // Repeat (finding prototypes’ prototypes)
                             // as long as there are prototypes to be found.

So, we will find out that the object’s prototype also has a prototype. That’s the chain the excerpt talks about.

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