JavaScript Functions Practice Exercises
Callbacks, scopes, and functional programming
Challenges
Return vs Log
Return vs Log
A function can log one value and return a different value. The log is for someon...
Argument Order
Arguments are matched to parameters by position. JavaScript does not look at the...
Parameters Beat Nearby Values
A parameter is the input for the current function call. If a function uses a sep...
Functions as Values
A function name can be used as a value. If you store the function without parent...
Returning from Branches
A function can choose between return values. Once a branch returns, that call is...
Reusable Input Cleanup
A reusable JavaScript function should clean the input it receives and return the...
Default Parameter Labels
A default parameter is a fallback for a missing argument. It is useful when most...
Arrow Function Returns
An arrow function with an expression body returns that expression automatically....
Rest Parameters
A rest parameter gathers extra arguments into an array. That lets a function acc...
Calling a Callback
A callback is a function passed into another function. The receiving function co...
Call Result vs Function Reference
Two lines can look similar while storing very different things. A bare function ...
Callback Validation
Practice JavaScript callback validation by running an array of checks against on...
Composing Function Calls
Practice JavaScript function composition by feeding one function's return value ...
Rest Parameter Aggregation
Use JavaScript rest parameters to gather flexible numeric arguments into an aver...
Step Sequences
Practice JavaScript function sequencing by passing a value through an ordered ar...
Safe Callback Calls
Practice JavaScript callback safety by checking whether a value is callable befo...
Recursion with a Base Case
Practice JavaScript recursion by writing a function with a clear base case for a...
Function Pipelines
Practice JavaScript function pipelines by collecting transformation steps with a...
Partial Application
Practice JavaScript partial application by returning a function that remembers l...
Dispatcher Functions
Practice JavaScript dispatcher functions by creating a reusable function around ...
Recursive Tree Search
Practice JavaScript recursive search by walking nested route arrays until a path...
Debounce
Practice JavaScript debounce by returning a wrapper that delays a function call ...
Throttle
Practice JavaScript throttle by returning a wrapper that runs immediately, then ...
Curry a Function
Practice JavaScript currying by collecting arguments across several calls until ...
Factorial
Practice recursive JavaScript functions by calculating factorial values with a c...
Fibonacci
Practice JavaScript functions by calculating Fibonacci numbers from previous val...
Recursive Flatten
Practice recursive JavaScript functions by flattening nested arrays into one lis...