call value inside a JS variable as a JS function name
- by user1640668
Hello I have a function to perform actions but name of the function is inside a variable...
below code will get the URL's hashed part example: #JHON and remove # and store it inside URLHASH variable..example: JHON
var urlhash = document.location.hash;
urlhash = urlhash.replace(/^.*#/, '');
always there is a function name from that value inside variable and i want to call value inside that variable as a function name
window.onload=function() {
Value inside URLHASH variable should run as a name of a variable. example: jhon();
};
Is it possible ? I tried some codes but it calls variable name as a function not value inside the variable..help me..