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.

JS Inheritance is awesome, and you're doing it wrong

9 pointsby bitsweetabout 11 years ago

1 comment

JacksonGarietyabout 11 years ago
I feel like this abuses Object.create.<p>It should be used to ease constructors into being children of other constructors, it shouldn&#x27;t be used when you only have one constructor.<p>&gt; &quot;So make a constructor, lazy ass.&quot;<p><pre><code> var wizard = { hasMagic: true }; function Wizard (name) { Object.create(wizard) } </code></pre> That is madness, or maybe I misunderstand.