- 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: Objects & Copying
Objects and arrays in JavaScript are passed around by reference, which leads to some of the most common bugs. This quiz tests references, const, spread copies, structuredClone(), the JSON trick and Object.freeze().
Domanda di esempio
Domanda 1 di 10What does this print?
const a = { x: 1 };
const b = a;
b.x = 2;
console.log(a.x);
Mostra la risposta
B. 2 const b = a copies the reference, not the object. Both names point to the same object, so changing b.x changes what a.x shows.
Cosa copre questo quiz
- Variables that point to the same object
- Shallow copies with spread and
Object.assign() - Deep copies with
structuredClone()and the JSON round trip - What
constandObject.freeze()really protect - Comparing objects with
===
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.