0Pricing
JavaScript Academy · Lesson

Declarations vs Expressions, Arrow Basics

Function declarations vs expressions, arrow function syntax, and simple usage patterns.

Intro

Goal: Tell function declarations from expressions, learn basic arrow syntax, and pick the simplest form for the job.

  • Declaration
  • Expression
  • Arrow basics
Declarations vs Expressions, Arrow Basics — illustration 1

Function declaration

A function declaration is hoisted, so calls may appear above the definition.

// Function declaration
// Can be called before or after its definition (hoisted)
console.log(greet("Ayla"));

function greet(name) {
  return "Hello, " + name + "!";
}

console.log(greet("Coder"));
Declarations vs Expressions, Arrow Basics — illustration 2

All lessons in this course

  1. Declarations vs Expressions, Arrow Basics
  2. Parameters, Defaults, Rest, and Returns
  3. this Basics; call/apply/bind (intro)
← Back to JavaScript Academy