I'm confused where should I use prototype to declare a method ? What I read is, if I create a method that is declared by prototype, all instances are using same reference so is it static or something different ? Because I can reach instance properties in a prototype method ? But in c#, you cannot reach class variables(not static) in static methods?
An Example:
function Calculator()
{
if(this === window){
return new Calculator();
}
this.Bar = "Instance Variable";
}
Calculator.prototype.SaySomething = function(thing){
return thing + " " + Bar;
}
Calculator().SaySomething("Test"); // Test Instance Variable