0% found this document useful (0 votes)
8 views

Type of Functions in js-1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Type of Functions in js-1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Aamina Khalid Web Developer

TYPES OF
FUNCTIONS IN
JAVASCRIPT
SWIPE TO LEARN
Aamina Khalid Web Developer

FOR WRITING EFFICIENT


CODE FUNCTIONS ARE
IMPORTANT

LET’S LEARN FUNCTION


TYPES TODAY

Arrow Functions
Anonymous Function
Callback Function
Aamina Khalid Web Developer

ARROW FUNCTIONS
Syntax to define
arrow function

greet("Jane");
// Output: Hello, Jane!

Arrow functions are shorter and easier to


write
They use => instead of the word function
and don't need curly brackets {}
Automatically return results (no need to
write return)
Aamina Khalid Web Developer

ANONYMOUS FUNCTIONS
No name defined

Anonymous fuctions are not provided with


name
They are often used as IIFEs to execute code
immediately
Are useful for creating closures or
encapsulating code
Aamina Khalid Web Developer

CALLBACK FUNCTIONS
An argument to another
function

Are passed as an argument to another


function
Are executed later time, often
asynchronously
Commonly used in event handling, timeouts,
and API requests
Aamina Khalid Web Developer

I HOPE YOU LIKED IT

UNTIL NEXT
TIME STAY
CURIOUS

You might also like