Ram

Lesson 7 of 20

Functions

Write reusable logic with function declarations and arrow functions.

Introduction

Functions receive inputs through parameters and may return a result.

Arrow functions provide a compact syntax that is common in modern React code.

Key insight

Write reusable logic with function declarations and arrow functions.

Example

const add = (a, b) => a + b;
console.log(add(4, 6));

This example shows the core functions idea in a small, runnable program.

Real-world example

Functions appears in everyday application code, scripts and APIs.

Test yourself

2-question check

1

What is the main idea in Functions?

2

Where can functions be useful?

Ready to check your understanding?

Answer every question, then submit your quiz.

Try it yourself

JavaScript compiler

Runs in your browser. Nothing is sent to a server.

Output appears here

Practice challenge

Write an arrow function that converts minutes to seconds.

Previous
Next