i have a question about JavaScript. I know how to use prototype, and why is it used, but i have tried to answer me this question, what will happen if i use prototype in a function like this,
var Command = function () {
var text = 'Hello World';
Command.prototype.run = function () {
console.log(text);
};
};
var command = new Command();
command.run();
Now I will be able to use also the private functions or variables. I have build with jsFiddle examples, with all variants and it shows that there seems no difference where I used prototype. But may I have overlocked something?