有没有关于如何组织 JavaScript 代码的好例子?

发布于 2024-11-10 00:05:23 字数 181 浏览 4 评论 0原文

我已经学习了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冰火雁神 2024-11-17 00:05:23

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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文