Stage 1 · Lesson 4 of 10
Functions, scope and arrow functions
package logic under a name. You will see three forms: function declarations, function expressions and , such as const add = (a, b) => a + b. They behave much the same until the keyword this gets involved, which comes later.
A function without return gives back undefined. Logging with console.log is not the same as returning. let and const have : a variable declared inside an if or a loop does not exist outside it.
Inner functions can read variables from the functions around them. Also learn default parameters (a value used when none is passed) and (...args, which gather extra arguments into an array). Small functions that take inputs and return values are what closures, and tests all build on.
A question to check yourself, an AI practice session and 2 cheat sheet entries come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking JavaScript Fundamentals
Design Gurus · Beginner · $50
The language itself, closures and async included, with runnable exercises per lesson
- GuideFreeJavaScript.info
Ilya Kantor
Free: Part 1 is the most complete modern JavaScript tutorial, with tasks per chapter