example of a javascript namespace with public and private methods and functions


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // testing namespace
  2. var crewrApp = new function() {
  3.  
  4. var internalFunction = function() {
  5. console.log('soy una función interna');
  6. };
  7.  
  8. this.publicFunction = function() {
  9. console.log('soy una función pública');
  10. };
  11.  
  12. var test1 = 'testing 1';
  13. this.test2 = 'testing 2';
  14.  
  15. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.