Let's say I have the following code:
var app = {};
app.post = {
foo: function() {
// defining a variable without the 'var' keyword inside a function.
bar = "Hello!";
}
}
I think the way that I defined the bar
variable is not good. I know you shouldn't have global variables. but, I defined it inside of a method which is inside of an object.
Is it a bad practice?