javascript pass function as parameter

JavaScript
//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);<!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>
Source

Also in JavaScript: