Is it bad to use local variable in the code below and if so, why?
var lib = new function () {
var localVariable;
this.publicCall = function (e) {
localVariable = e.variable;
};
var privateCall = function (e) {
localVariable = e.variable;
};
};
No, in fact I’d say that looks like good practice.
What alternative were you thinking of? A global variable? Now that would be bad practice.