I have requirement to pass function name as parameter and execute it. Is there any way to achieve it in node js.
I tried below code. While making call to another function inside myFunc1 I want to call newFunct instead of fName. With below code I am getting error - TypeError: fName is not a function
var myFunction = 'newFunct';
myFunc1(myFunction);
function myFunc1(fName){
fName('World'); // Here instead of calling fName it should call newFunct
}
function newFunct(val){
console.log("Hello " + val);
}