Quiz di JavaScript: Functions & Arrow Functions

This JavaScript quiz checks the different ways to define a function. You will predict what arrow functions return, see which functions can be called before their line and learn what arrow functions can't do.

Facile 10 domande ~5 minuti Superato con il 80% Node.js 22

Scegli una modalità

Stai giocando come ospite: accedi per salvare XP e serie.

Domanda di esempio

Domanda 1 di 10

What does this print?

const double = (n) => n * 2;
console.log(double(4));
Mostra la risposta

A. 8 An arrow function with no braces returns its expression automatically. So double(4) returns 4 * 2, which is 8.

Cosa copre questo quiz

  • Function declarations, expressions and arrow functions
  • Implicit return in arrow functions, and when braces need return
  • Returning an object literal from an arrow function
  • Missing arguments become undefined
  • Functions as values in arrays and callbacks

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.