- Esecutori
-
Impara
Impara Python Esempi eseguibili, NumPy, pandas e altro Impara l'IA / Machine LearningReti neurali, ML e LLM da zero Impara C e C++ Puntatori, memoria, STL e C++ moderno Impara C#Fondamenti, OOP, LINQ, async ed esercizi .NET Impara MatplotlibGrafici a linee, barre, dispersione e torta con visualizzatori Impara RustOwnership, trait, gestione degli errori e thread Impara GoSlice, interfacce, goroutine e canali Algoritmi Python Ricerca, ordinamento, ricorsione e visualizzazioni O(n) Algoritmi C e C++ Confronta le implementazioni in C e C++ Programmazione per bambini Impara a programmare giocando!
- QuizNuovo
- SfideNuovo
- Per docentiNuovo
- Aggiornamenti
- Offrimi un caffè
Quiz di JavaScript: Prototypes
This JavaScript quiz looks under the hood of objects, at the prototype chain that classes are built on. You will predict output for Object.create, shadowed properties, instanceof and for...in, and pick the right way to link constructor functions.
Domanda di esempio
Domanda 1 di 10What does this print?
const animal = {
sound: "...",
speak() { return this.sound; },
};
const dog = Object.create(animal);
dog.sound = "woof";
console.log(dog.speak(), animal.speak());
Mostra la risposta
B. woof ... dog has no speak of its own, so it is found on animal, but this is still dog, the object before the dot. dog.sound is its own property and shadows the one on animal.
Cosa copre questo quiz
- How property lookup walks the prototype chain
- Reading vs writing an inherited property
prototypevsObject.getPrototypeOf()in,Object.hasOwn()andfor...inwith inherited keys- Objects with no prototype from
Object.create(null)
Domande frequenti
Serve un account?
No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.
Posso rifarlo?
Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.