JS Basic Tutorial
A function in JavaScript is a reusable block of code designed to perform a specific task. Functions make code modular, readable, and reusable.
function functionName(parameters) { // Function body return value; }
A function declaration defines a named function using the function
keyword.
Try it yourself
A function expression assigns a function to a variable.
const functionName = function(parameters) { // Function body return value; }
Try it yourself
Arrow functions provide a shorter syntax and automatically bind this
.
const functionName = (parameters) => { // Function body };
Try it yourself
An IIFE runs immediately after being defined.
Try it yourself