Back to Course

Introduction to JavaScript

0% Complete
0/0 Steps
  1. JavaScript: Basics
    9Topics
    |
    10 Quizzes
  2. JavaScript: Variables
    9Topics
    |
    10 Quizzes
  3. JavaScript: Conditional Statements
    10Topics
    |
    11 Quizzes
  4. JavaScript: Functions
    10Topics
    |
    11 Quizzes
  5. JavaScript: Scope
    6Topics
    |
    7 Quizzes
  6. JavaScript: Arrays
    11Topics
    |
    12 Quizzes
  7. JavaScript: Loops
    8Topics
    |
    9 Quizzes
  8. JavaScript: High Order Functions
    3Topics
    |
    3 Quizzes
Lesson 4, Topic 9
In Progress

JavaScript: Arrow Functions

Yasin Cakal 7 Nov 2021
Lesson Progress
0% Complete

ES6 introduced arrow function syntax, which uses the special “fat arrow” ()=> notation to make it easier to write functions.

When you use arrow functions, you don’t have to type the keyword function every time you want to create a function. Instead, put the parameters inside the ( ) and then add an arrow => to the function body surrounded in { } like this:

const squarePerimeter = (length) => {
  let perimeter = 4*length;
  return perimeter;
};

It is important to be familiar with the various ways of writing functions because you will encounter each of these when reading other JavaScript code.

Responses

Leave a Reply

%d bloggers like this: