Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

example of callback function in javascript

<html>  
<head>  
  
</head>  
<body>  
<h1>Hello User</h1>  
<h2> This is the softhunt.net</h2>  
<script>  
function showData(name, amt) {  
alert(' Hello ' + name + '
 Your entered amount is ' + amt);  
}  
  
function getData(callback) {  
var name = prompt(" Welcome to the softhunt.net 
 What is your name?");  
var amt = prompt(" Enter some amount...");  
callback(name, amt);  
}  
  
getData(showData);  
</script>  
</body>  
  
</html>
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #callback #function #javascript
ADD COMMENT
Topic
Name
7+5 =