In javascript, if you have a function that executes a block of code and you want to pass this function as a parameter of another function. You can use the code examples explained here.
function message() {
return "Devsheet";
}
function print_message(my_function) {
var msg = my_function();
console.log(`Hello from ${msg}`);
}
print_message(message);
0 Comments