Search code examples
javascriptdesign-patternscode-organization

Are there any good examples on how to organize JavaScript code?


I've learned JavaScript and know how to write OO JavaScript, and I can accomplish those assignment like autocomplete, photo gallery with JavaScript, but I just don't know how to organize the codes. For example, when and where to define a function, how to organize those variables, etc.
So I'm looking for some good and simple examples of JavaScript project to learn the good practices. Can you suggest any? (such as a list data filter).


Solution

  • http://www.klauskomenda.com/code/javascript-programming-patterns/

    That link discusses many different javascript organization patterns, including the one I prefer, the Revealing Module Pattern.

    More information about the Revealing Module Pattern is here:

    http://www.wait-till-i.com/2007/08/22/again-with-the-module-pattern-reveal-something-to-the-world/