Fundamentals / Functions
Functions
Reusable blocks of behavior — declared, expressed, or arrow-shaped.
A function packages a block of code under a name so it can run whenever it's called, with different inputs each time. Function declarations are hoisted (usable before their line); function expressions and arrow functions are not. Parameters can have defaults, and `...rest` gathers any extra arguments into an array.
Codeeditable — Run and Step both follow your edits
Loading...
Console
Output will appear here
Visualization
Result
Press Step to watch each line's result appear here
Why?
Default parameters only kick in when an argument is undefined or omitted entirely — passing null still overrides the default.