🚗🏍️ Welcome to Motoshare!

Turning Idle Vehicles into Shared Rides & New Earnings.
Why let your bike or car sit idle when it can earn for you and move someone else forward?

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Partners earn. Renters ride. Everyone wins.

Start Your Journey with Motoshare

CallBack Function in JavaScript

Uncategorized

In this tutorial, you will learn about JavaScript callback functions with the help of examples.

In JavaScript, you can also pass a function as an argument to a function. This function that is passed as an argument inside of another function is called a callback function.

Example:

// function
function greet(name, callback) {
    console.log('Hi' + ' ' + name);
    callback();
}

// callback function
function callback() {
    console.log('this is callback fundtion');
}

// passing function as an argument
greet('abhishek', callback);

OutPut:

Hi abhishek
this is callback fundtion

In the above program, there are two functions. While calling the greet() function, two arguments (a string value and a function) are passed.

The callback() function is a callback function.

0 0 votes
Article Rating
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] CallBack Function in JavaScript […]

1
0
Would love your thoughts, please comment.x
()
x