I'm experimenting with running a function from a dynamic string...
say I have several functions and i don't want to use 'if else' or inline...
yes()
no()
maybe()
sometimes()
whoknows()
random()
so I am trying this:
window['yes']();
but I am stuck with namespace. as I get the error 'global has no method yes' I am not sure how to tell what namespace i am in.
$(document).ready(function(){
function yes(){console.log('yes?');}
window['yes']();
});
How do I find out or set the current namespace?
If I did set the namespace how do I start running the code in it immediately or does that just happen on its own?