← All tutorials

GoCareerGo Tutorials

JavaScript Tutorial

Variables to closures, promises, the DOM and OOP — a complete JS reference.

Arrow Functions

A concise function syntax introduced in ES6 that does NOT have its own this, arguments, or prototype.

const add = (a, b) => a + b;
const square = x => x * x;
const greet = () => console.log('hi');
  • Shorter syntax, implicit return for single expressions
  • No own this — inherits it from the enclosing scope (great for callbacks)
  • Cannot be used as a constructor (no new)
  • No arguments object — use rest parameters instead
Tip

Give one concrete reason to avoid arrow functions: object methods that need their own this.