- Tutorials
- JavaScript Tutorial
- JavaScript Functions
JavaScript Functions
14 lessonsAbout 84 minutesBeginner
This part of the JavaScript Tutorial runs from JavaScript Functions through to JavaScript Pure Functions. There are 14 lessons here, and working through them takes about 84 minutes at a steady pace.
It follows on from JavaScript Loops, so finish that first if you have not already — the examples below assume you are comfortable with it.
Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.
- 1JavaScript FunctionsA JavaScript function is a block of code that you can name once and run whenever you need it.
- 2JavaScript Function DeclarationsA JavaScript function declaration defines a named function using the function keyword.
- 3JavaScript Function ExpressionsA JavaScript function expression stores a function inside a variable.
- 4JavaScript Function ParametersJavaScript function parameters are the names listed when a function is defined.
- 5JavaScript Default ParametersJavaScript default parameters give a parameter a value to use when no argument is passed.
- 6JavaScript Rest ParametersJavaScript rest parameters collect any number of arguments into a single array.
- 7JavaScript return StatementThe JavaScript return statement sends a value back from a function and stops it running.
- 8JavaScript Arrow FunctionsJavaScript arrow functions are a shorter way to write a function expression.
- 9JavaScript Callback FunctionsA JavaScript callback function is a function passed to another function to be run later.
- 10JavaScript Higher Order FunctionsA JavaScript higher order function is a function that takes a function as an argument or returns one.
- 11JavaScript RecursionJavaScript recursion is when a function calls itself to solve a smaller version of the same problem.
- 12JavaScript IIFEA JavaScript IIFE is a function that runs immediately after it is defined.
- 13JavaScript call, apply and bindJavaScript call, apply and bind let you choose what the this keyword refers to inside a function.
- 14JavaScript Pure FunctionsA JavaScript pure function always returns the same result for the same input and changes nothing outside itself.
