Lesson 6 of 55
javascriptFunctions – declarations, expressions & arrow functions
11 mins
Course progress11%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 6 of 55
javascript11 mins
Keep these ideas in mind as you work through the lesson.
Function Declaration:
function add(a,b){ return a+b; }
Function Expression:
const multiply = function(a,b){ return a*b; };
Arrow Function (ES6):
const divide = (a,b) => a / b;
Key differences:
this.arguments object – use rest parameters (...args).thisconst obj = {
value: 42,
getValue: () => this.value // `this` refers to the surrounding scope (window), NOT obj!
};