TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: JavaScript code base to read and learn from

10 点作者 ahmadajmi将近 11 年前
I just discovered this amazing site http:&#x2F;&#x2F;www.readingcodegood.com&#x2F; and watched the talk, it&#x27;s very inspire. She gives good examples of Ruby that is nearly ~ 100 line of code. I just want to do this exercise with JavaScript and I want to get some very good and clean JavaScript code to read and learn from. Any suggestions?<p>Thanks

2 条评论

BonsaiDen将近 11 年前
In general there are two types of JS code bases you&#x27;ll encounter, the ones for the Browser which end up putting everything into a single file and the ones for Node.js, which (in most cases) organize their code in the usual directory &#x2F; file structures you may be used too from other programming languages.<p>There are also multiple camps which battle about whether too use semicolons at all and where to place commas that separate the individual parts of `var` statements. I&#x27;m not going to take any sides here, since I think that style is something everyone has to decide on their own :)<p>Now as for the code to read, there&#x27;s obviously jQuery, but Angular.js is definitely a good read too these days.<p><a href="https://github.com/angular/angular.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;angular&#x2F;angular.js</a><p>If you&#x27;re into parsing (or want to learn about it), there&#x27;s also Esprima which is a JavaScript Parser written in JavaScript:<p><a href="https://github.com/ariya/esprima" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ariya&#x2F;esprima</a><p>Taking a look at NPM might give you an idea of another syntax style, since commas are infront of the lines here and there are no semicolons:<p><a href="https://github.com/npm/npm/tree/master/lib" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;tree&#x2F;master&#x2F;lib</a><p>And last but no least a shameless plug or two!<p>gbaasm this is a assembler for z80 GameBoy code (which takes assembly files and build a ROM) written by myself, it has a big focus on performance and is another example of lexing &#x2F; parsing source code.<p><a href="https://github.com/BonsaiDen/gbasm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;BonsaiDen&#x2F;gbasm</a><p>For something short and sweet I got a minimal 2D physics engine here. Beware though, if you&#x27;re new to physics simulation is can be quite hard to figure out what excactly is going on:<p><a href="https://github.com/BonsaiDen/box" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;BonsaiDen&#x2F;box</a>
评论 #8132154 未加载
mattkrea将近 11 年前
I believe this was posted on HN a while back but check out this video and the jQuery repo. It&#x27;s actually very, very interesting.<p><a href="http://www.paulirish.com/2010/10-things-i-learned-from-the-jquery-source/" rel="nofollow">http:&#x2F;&#x2F;www.paulirish.com&#x2F;2010&#x2F;10-things-i-learned-from-the-j...</a>
评论 #8132160 未加载