Learn JavaScript: Functions and Scope
Write reusable JavaScript functions: declarations, parameters and defaults, return values, helper functions, function expressions and arrow functions, then learn how scope decides where variables live and how to keep them tidy.
- Beginner level
- 2 modules
- 15 lessons
- 67 tasks and questions
Syllabus
01FunctionsPackage code into reusable functions: declare and call them, pass in arguments, set default parameters, return results, combine helper functions, and write the same ideas as function expressions and arrow functions.9 lessons
02ScopeLearn where variables can be used: the global scope, block scope inside functions and if statements, why too many global variables cause bugs, and how to keep each variable in the smallest scope it needs.6 lessons