JavaScript tips
JavaScript
Function Types
Slim toumi
Slim toumi
JavaScript tips
Named Function
A function with a name. You can call it by using its name.
👉 How it works:
You create the function using function and a name.
To run it, type the name followed by ().
Slim toumi
Slim toumi
JavaScript tips
Anonymous Function
A function without a name, often used where a function is
needed temporarily.
👉 How it works:
This function is created on the spot and doesn’t need a name.
It’s used directly inside another function, like setTimeout.
Slim toumi
Slim toumi
JavaScript tips
Arrow Function
A shorter way to write functions, introduced in ES6.
👉 How it works:
Use => instead of function.
It’s great for writing short, clean code.
Slim toumi
Slim toumi
JavaScript tips
IIFE Immediately Invoked Function Expression
A function that runs as soon as it’s created.
👉 How it works:
Wrap the function in () and add () at the end to run it
immediately.
Slim toumi
Slim toumi
JavaScript tips
Callback Function
A function passed to another function to run later.
👉 How it works:
One function (like greet) takes another function as an input
and runs it.
Slim toumi
Slim toumi
JavaScript tips
Recursive Function
A function that calls itself until it finishes a task.
👉 How it works:
The function runs repeatedly, reducing the number each
time.
It stops when the number is 0 (a "base case").
Slim toumi
Slim toumi
JavaScript tips
Hopefully You Found It
Usefull!
Be sure to save this post so you
can come back to it later
like Comment Share
Slim toumi
Slim toumi