Answers for "javascript pass function as parameter"

5

javascript pass function as parameter

//passing a function as param and calling that function
function goToWork(myCallBackFunction) {
    //do some work here
    myCallBackFunction();
}

function refreshPage() {
    alert("I should be refreshing the page");
}

goToWork(refreshPage);
Posted by: Guest on July-31-2019
1

How to Pass Parameter in JavaScript Function From Html

<!DOCTYPE html>
<html>
<head>
	<title>function parameters javascript</title>
</head>
<body>
<button onclick="myfunctionName('rohan')">Click</button>

<script type="text/javascript">
	
	function myfunctionName(a){

		alert(a);
		
	}

</script>
</body>
</html>
Posted by: Guest on July-05-2020

Code answers related to "javascript pass function as parameter"

Code answers related to "Javascript"

Browse Popular Code Answers by Language