JavaScript calls methods of functions through strings

From , 5 Years ago, written in JavaScript, viewed 183 times.
URL https://pastebin.vip/view/77ae1a5d
  1. var strFun = "someFunction"; //Name of the function to be called
  2. var strParam = "this is the parameter"; //Parameters to be passed in function
  3.  
  4. //Create the function
  5. var fn = window[strFun];
  6.  
  7. //Call the function
  8. fn(strParam);
  9.  
  10.  
  11. //javascript/8779

Reply to "JavaScript calls methods of functions through strings"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website