I have a bunch of functions that look like this
'tea' : function (caller) {
this.speak(this.randomOption('tea_msg'));
},
'chill' : function (caller) {
this.speak(this.randomOption('chill_msg'));
},
and what i want is to merge them to something like this
'tea' ,'chill': function (caller) {
// get which function name was called in var lets call it fun
this.speak(this.randomOption(fun +'_msg'));
}
Is this possible or am I going about this the wrong way?
You can also write a generic
sayfunction: