How would one do something like the following:
var turret = new Turret();
Turret.prototype.fire = shootMissiles("atAirUnits"),
I want know how to make it so that a call to
calls all of these functions with their given parameters. Keep in mind the
function needs to still have access to
from the Turret class. I understand function composition to a certain extent, but with that the result of one of the functions is passed as an argument to the next which I do not want.
Any of these functions such as shootMissiles could take different or more arguments, such as "atTanks" or "atRandom". Also any other class such as rocketSoldier could use shootMissiles function in its fire function with different parameters. Another function such as shootMissiles might need access to Turret class variables such as this.missileSize. If I have been unclear, please comment with how I should elaborate.