Function Drills

Switch between declarations, arrows, defaults, rest, and higher-order patterns until they feel automatic.

Step 1 of 6

Functions are the substrate

Closures, this, generics — every advanced topic in this module rests on confidence with the four function shapes:

  • Declaration: function add(a, b) { return a + b; }
  • Expression: const add = function (a, b) { return a + b; };
  • Arrow: const add = (a, b) => a + b;
  • Method: { add(a, b) { return a + b; } }

Plus the parameter features: defaults, rest (...args), and destructuring. Let's drill them.