... as parameter js

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);
Source

Also in JavaScript: