How to pass a runnable procedure (a function) as a parameter and run it in JavaScript

1 Answer

0 votes
function runnableProcedure(f) {
  f(); // Execute the passed function
}

// Define a function to pass
function say() {
  console.log("abcd");
}

// Pass the function as a parameter
runnableProcedure(say);



/*
run:

abcd

*/

 



answered May 22, 2025 by avibootz
...