- 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: Default & Rest Parameters
This JavaScript quiz covers default parameter values and rest parameters (...args). You will predict when a default is used, what a rest parameter holds and how it differs from the old arguments object and from spread.
Domanda di esempio
Domanda 1 di 10What does this print?
function greet(name = "friend") {
return `Hi, ${name}`;
}
console.log(greet());
Mostra la risposta
C. Hi, friend No argument was passed, so name would be undefined and the default "friend" is used instead.
Cosa copre questo quiz
- Default values like
function greet(name = "friend") - A default is used for
undefined, not fornullor0 - Rest parameters collect extra arguments into a real array
- Rest vs the
argumentsobject, and rest vs spread - Defaults are evaluated on every call
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.