Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Functions – declarations, express | JavaScript Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. JavaScript Course

Lesson 6 of 55

·javascript

Functions – declarations, expressions & arrow functions

11 mins

Course progress11%

What you'll learn

Keep these ideas in mind as you work through the lesson.

3 points
  • Use arrow functions for callbacks where you need the surrounding `this`.
  • Function declarations are hoisted; function expressions are not.
  • Rest parameters (`...args`) replace the old `arguments` object.

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:

  • Arrow functions lexically bind this.
  • No arguments object – use rest parameters (...args).
  • Cannot be used as constructors.

Example: Arrow function preserving this

const obj = {
  value: 42,
  getValue: () => this.value   // `this` refers to the surrounding scope (window), NOT obj!
};
Make it stickPractice what you've learned1 quiz · 7 practical tests · Optional activities from JavaScript CourseBrowse activities
Previous lessonControl Flow – if / switch / loopsContinue to lesson 7Scope, Closures & the Execution ContextBack to JavaScript Course curriculum