JavaScript Functions Explained 2026 #8 | Master Functions Fast

Learn JavaScript functions in this beginner-friendly 2026 tutorial. Understand how to create, call, and reuse functions with parameters, return values, and real-world examples.Learn how JavaScript functions work, including parameters and return values. Beginner-friendly guide with simple examples.

 

-----------------------------------------------------------------------code is here--------------------------------------------------------------------------

//Goal of Day 8

//By the end of Day 8, the student will:

//Understand what a function is

//Create reusable blocks of code

//Use parameters and return values correctly

//Think in modular, scalable logic



 

function add(){

  console.log(2000+5000);  

}


 

add();


 

// function with Parameters

function greet(name){

    console.log("Hello "+ name);

}


 

greet("Khan");

greet("Ali");


 

// function with return values


 

function sum(a,b){

    return a+b;

}


 

let result = sum(10,20);

console.log(result);


 

// salary calculator

function calculateSalary(basic,bonus){

    return basic + bonus;

}


 

let totalSalary = calculateSalary(50000,1000);

console.log("Total Salary: " + totalSalary);

// Arrow function

const multiply = (x,y) => x*y;

let product = multiply(5,10);

console.log("Product: " + product);

----------------------------------------------------------------------end----------------------------------------------------------------------------------