TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Understanding Javascript OOP

154 pointsby old_soundover 12 years ago

10 comments

joubertover 12 years ago
The ES6 draft spec now includes the (maximally minimal) class spec that was hashed out at the July TC 39 meeting. You can read the spec here: <a href="http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts" rel="nofollow">http://wiki.ecmascript.org/doku.php?id=harmony:specification...</a> and see some examples here: <a href="http://wiki.ecmascript.org/doku.php?id=strawman:maximally_minimal_classes" rel="nofollow">http://wiki.ecmascript.org/doku.php?id=strawman:maximally_mi...</a><p>There's a cool project, Harmonizr (<a href="https://github.com/jdiamond/harmonizr" rel="nofollow">https://github.com/jdiamond/harmonizr</a>) which transpiles ES6 to ES5, which you can leverage to start using classes, modules, arrow syntax, etc. now. Demo: <a href="http://jdiamond.github.com/harmonizr/demo/demo.html" rel="nofollow">http://jdiamond.github.com/harmonizr/demo/demo.html</a>
评论 #4609743 未加载
评论 #4607073 未加载
zwiebackover 12 years ago
Thanks for that. In my mind I've been calling C++, C#, etc. "class-based" programming since the design/programming phase is really focussed on classes. I've not much experience with prototype-based programming other than the occasional blurb. This is a nice intro.
评论 #4607857 未加载
评论 #4607351 未加载
评论 #4609209 未加载
rbellioover 12 years ago
I was just looking for something like this last week, this is a great tutorial, thanks for posting it up here.<p>When Anders was discussing the new TypeScript release, he was mentioning how it more clearly mimicked the ES6 specification. Looking at some of the examples posted by joubert, you can see the similarities.<p>TypeScript transpiles down to ES5 much like Harmonizr does as well.<p>Very interesting stuff.
jasonkostempskiover 12 years ago
I thought I had read it all at this point. I really like the deep dive into Object. No one ever goes beyond Object.create() and that's usually just as an example of how not to create new objects :)
justinjover 12 years ago
or, for a shorter read, try <a href="http://yehudakatz.com/2011/08/12/understanding-prototypes-in-javascript/" rel="nofollow">http://yehudakatz.com/2011/08/12/understanding-prototypes-in...</a>
migfromparisover 12 years ago
Really good tutorial. I enjoyed reading it.
grandalfover 12 years ago
This is superb.
jroseattleover 12 years ago
very well done.
SwearWordover 12 years ago
This is the best js tutorial I've seen in a while
andylover 12 years ago
Great tutorial - thank you.