最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

design patterns - Are there any good examples on how to organize JavaScript code? - Stack Overflow

programmeradmin3浏览0评论

I've learned JavaScript and know how to write OO JavaScript, and I can acplish those assignment like autoplete, 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).

I've learned JavaScript and know how to write OO JavaScript, and I can acplish those assignment like autoplete, 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).

Share Improve this question edited Feb 25, 2014 at 18:33 Rodrigo 4938 silver badges14 bronze badges asked May 27, 2011 at 17:06 wong2wong2 35.8k51 gold badges137 silver badges182 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 16

http://www.klauskomenda./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./2007/08/22/again-with-the-module-pattern-reveal-something-to-the-world/

发布评论

评论列表(0)

  1. 暂无评论