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 in Java-Script by kartik
• 10,760 points

recategorized Jan 31 by Niroj 168 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 by Niroj
• 21,680 points

Related Questions In Java-Script

0 votes
1 answer

What is the difference between node.js and io.js?

Hello, io.js: Node-forward is basically being merged into io.js forked on ...READ MORE

answered Apr 24 in Java-Script by Niroj
• 21,680 points
22 views
0 votes
1 answer

How can we access PHP variables in JavaScript or jQuery rather than <?php echo $variable ?>

Hello @kartik, You can also use json_encode for ...READ MORE

answered Apr 29 in Java-Script by Niroj
• 21,680 points
71 views
0 votes
1 answer

How to access PHP session variables from jQuery function in a .js file?

Hello, You can produce the javascript file via ...READ MORE

answered Apr 29 in Java-Script by Niroj
• 21,680 points
117 views
0 votes
1 answer

How to create dynamic href in react render function?

Hello @kartik, Use string concatenation: href={'/posts/' + post.id} The JSX ...READ MORE

answered May 18 in Java-Script by Niroj
• 21,680 points
24 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 in Web Development by Niroj
• 21,680 points

edited Jan 21 by Niroj 67 views
+1 vote
1 answer

What is css box module?

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

answered Jan 20 in Web Development by Niroj
• 21,680 points

edited Jan 21 by Niroj 53 views
0 votes
1 answer

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

hii, visibility:hidden; and display:none are totally different used ...READ MORE

answered Jan 20 in Web Development by Niroj
• 21,680 points
349 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 in Web Development by Niroj
• 21,680 points

edited Jan 21 by Niroj 52 views
0 votes
1 answer

What are XMLHttpRequest Object in Ajax?

 As, you are up to ajax so ...READ MORE

answered Jan 31 in Java-Script by Niroj
• 21,680 points
44 views
0 votes
1 answer

what is the $(document).ready equivalent without jQuery?

Hello @kartik, There are three options: If script is the last ...READ MORE

answered Apr 2 in Java-Script by Niroj
• 21,680 points
73 views