What is callback function in JavaScript

0 votes
What is the use of callback function used in angularjs? Does it play any important role in designing web page?
Jan 30, 2020 in Java-Script by kartik
• 37,520 points

recategorized Jan 31, 2020 by Niroj 19,058 views

1 answer to this question.

0 votes
  • callback is not a keyword, its just a name of parameter that is passed into the function, you can call it whatever you want (callback or cb is pretty common).

  • Callback function is a function which is passed to a function as parameter and is executed when the outer function is completed.
  •  Callbacks are a feature of JavaScript not particularly angularjs. Its a way to send a function as a parameter to the callee so that the callee call that function once the task is finished.
  • Example of callback function:
    function useAsCallback(string){
      console.log("callback is being executed with passed parameter: " + string)
    }
    
    function main(param, callback){
      callback(param)
    }
    
    main(123456, useAsCallback)
  • I found this website to be useful for learning ANGULARJS . Have a look at the site. Hope it helps.    https://www.edureka.co/masters-program/full-stack-developer-training
answered Jan 30, 2020 by Niroj
• 82,840 points

Related Questions In Java-Script

0 votes
0 answers

What is the difference between ' and " in JavaScript?

I came across this query and am ...READ MORE

Sep 23, 2022 in Java-Script by Abhinaya
• 1,160 points
648 views
0 votes
1 answer

How to pass an array as a function parameter in JavaScript?

Hello @kartik, Use: const args = ['p0', 'p1', 'p2']; call_me.apply(this, ...READ MORE

answered Sep 4, 2020 in Java-Script by Niroj
• 82,840 points
1,757 views
0 votes
1 answer

How to Determine if page is valid in JavaScript - ASP.NET?

Hello @kartik,  Make the call on an input ...READ MORE

answered Sep 9, 2020 in Java-Script by Niroj
• 82,840 points
2,831 views
0 votes
0 answers

What is difference between mutable and immutable String in java?

As far as I know, An immutable string ...READ MORE

Sep 22, 2022 in Java-Script by Tejashwini
• 3,820 points
512 views
+1 vote
1 answer

What is the relationship between angularjs Scope with controller/view?

Let us consider the below block: <div ng-controller="emp"> ...READ MORE

answered Jan 20, 2020 in Web Development by Niroj
• 82,840 points

edited Jan 21, 2020 by Niroj 1,210 views
+1 vote
1 answer

What is css box module?

Hey, All the element present in html follows ...READ MORE

answered Jan 20, 2020 in Web Development by Niroj
• 82,840 points

edited Jan 21, 2020 by Niroj 1,238 views
0 votes
3 answers

Explain the difference between visibility:hidden; and display:none?

display:none means that the tag in question will ...READ MORE

answered Dec 14, 2020 in Web Development by Gitika
• 65,770 points
119,830 views
+1 vote
1 answer

How to access the Angularjs scope of a particular html element from our console?

Hello, You should follow the below steps:-- 1.Compile and ...READ MORE

answered Jan 21, 2020 in Web Development by Niroj
• 82,840 points

edited Jan 21, 2020 by Niroj 3,047 views
0 votes
1 answer

What is the “hasClass” function with plain JavaScript?

Hello @Kartik, Simply use classList.contains(): if (document.body.classList.contains('thatClass')) { ...READ MORE

answered Sep 2, 2020 in Java-Script by Niroj
• 82,840 points
1,100 views
0 votes
1 answer

What is an appropriate content-type header for JavaScript files?

Hello @kartik, JS has two registered MIME types:  The ...READ MORE

answered Jul 7, 2020 in Java-Script by Niroj
• 82,840 points
2,672 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP