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

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. JavaScript Course

Lesson 6 of 55 · javascript

Functions – declarations, expressions & arrow functions

Duration: 11 mins

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!
};
Previous: Control Flow – if / switch / loopsNext: Scope, Closures & the Execution Context