|
|
|
|
|
by benjisg
5585 days ago
|
|
There is actually a much better way to make private functions and properties in JavaScript using the module pattern and closure. Since all functions are objects in JS, you can create a function with some internal (private) functions and properties than return a object with some publicly accessible functions. A basic example: https://gist.github.com/866343 Closure gives you a really powerful structure that lets you encapsulate your code and then you don't have to use this and risk clobbering the global window object :) |
|