有没有关于如何组织 JavaScript 代码的好例子?
我已经学习了 JavaScript 并且知道如何编写 OO JavaScript,并且我可以使用 JavaScript 完成自动完成、照片库等任务,但我只是不知道如何组织代码。例如,何时何地定义函数、如何组织这些变量等
所以我正在寻找一些好的、简单的 JavaScript 项目示例来学习好的实践。你能建议一下吗? (例如列表数据过滤器)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://www.klauskomenda.com/code/javascript-programming-patterns/
该链接讨论许多不同的 javascript 组织模式,包括我更喜欢的一种,揭示模块模式。
有关揭示模块模式的更多信息如下:
http://www .wait-till-i.com/2007/08/22/again-with-the-module-pattern-reveal-something-to-the-world/
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/