Skip to main content
9 events
when toggle format what by license comment
Nov 1, 2015 at 2:17 comment added Hidden True @Bergi I'd forgotten that it was instance specific
Nov 1, 2015 at 0:14 history closed Felix Kling
Oriol javascript
Duplicate of Accessing private member variables from prototype-defined functions
Nov 1, 2015 at 0:02 answer added kube timeline score: 0
Oct 31, 2015 at 23:34 comment added JAAulde JavaScript does not have a notion of private methods or properties. You can define variables and functions inside of the constructor, and define methods in the constructor as well, thereby giving the "public" methods access to the "private" variables and functions. None of this, however, involves the prototype. Methods defined on the prototype are not in scope to access the variables and functions defined inside the constructor. So what you want is not possible. Also note that the more you do in the constructor the heavier the processing for instantiation will be.
Oct 31, 2015 at 23:32 comment added Bergi Modifying class behaviour later (from outside) basically requires non-private variables
Oct 31, 2015 at 23:31 comment added Bergi That's not "private", that's what we called "instance-specific" or "own properties" (and they're still public).
Oct 31, 2015 at 23:28 comment added Hidden Private being methods not living on the prototype. And prototype for being able to modify class behavior at some future date with a derived sub "class".
Oct 31, 2015 at 23:16 comment added Bergi Please define "private" and why tell us why you want to use the prototype.
Oct 31, 2015 at 23:14 history asked Hidden CC BY-SA 3.0