Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 2
    there is no way to do it. you can find it here. stackoverflow.com/questions/436120/… Commented Oct 21, 2016 at 11:13
  • 1
    Why don't you want to save url in My_controller? It makes sense to save it there as a property if you want to use it in your controller's methods. Commented Oct 21, 2016 at 11:14
  • 1
    You are needlessly getting lost in the weeds here. If you are so concerned about information hiding that you feel the need for 'private' variables (which JS doesn't even have) then you don't use prototypes. How many of these things are you really creating anyway? Is this optimization (use of prototype methods to avoid allocation of function objects) saving you megabytes or just bytes? Commented Oct 21, 2016 at 11:36
  • This is due to inheritance, really Commented Oct 21, 2016 at 11:40
  • @Reason its possible in ES6+, see my answer. Commented Oct 21, 2016 at 11:56