- 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: this, call, apply & bind
This JavaScript quiz covers this, one of the most asked interview topics. You will work out what this is in methods, detached functions and arrow functions, and set it yourself with call, apply and bind.
Domanda di esempio
Domanda 1 di 10What does this print?
const user = {
name: "Ann",
greet() {
return `Hi, ${this.name}`;
},
};
console.log(user.greet());
Mostra la risposta
A. Hi, Ann When a function is called as user.greet(), this is the object before the dot. So this.name is "Ann".
Cosa copre questo quiz
thisis decided by how a function is called, not where it is written- Losing
thiswhen a method is passed around - Arrow functions take
thisfrom the surrounding code callandapplyrun a function with a chosenthisbindreturns a new function withthisfixed for good
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.