Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4249232
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:22:11+00:00 2026-05-21T04:22:11+00:00

In Felix’s Node.js Style Guide it says: Do not extend the prototypes of any

  • 0

In Felix’s Node.js Style Guide it says:

Do not extend the prototypes of any
objects, especially native ones. There
is a special place in hell waiting for
you if you don’t obey this rule.

This article also made me question the uses of prototypes. If you are going to add a method later on in the code, why not just add it in the original constructor?

So, when is it ever necessary to extend the prototype of an object?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:22:12+00:00Added an answer on May 21, 2026 at 4:22 am

    No, prototypes are not bad. Quite the opposite, JavaScript is a prototypal language and prototypes are how you are supposed to extend objects.

    The quote is against extending Object.prototype specifically. Not “An object’s prototype”. Everything in JavaScript inherits from Object, so messing with its prototype effects everything. It breaks for(var n in obj){ loops and is just annoying.

    That’s the only thing against prototypes — they show up in for-in loops. Other than that, they are, BY FAR, the best performing way to extend objects in JS.

    As for why — Adding objects in the constructor, say:

    function myClass(){
        this.someMethod = function(){ ... }
    }
    

    means you will have a seperate function for every instance of the class. Doing it via a prototype:

    myClass.prototype.someMethod = function(){ ... }
    

    means there will only ever be one copy of that function. Much more memory efficient, and allows for hot-editing of the language. Let’s say you want to edit String.prototype, for instance:

    String.prototype.trim = function(){ ... }
    

    If you just added that to the constructor somehow, existing strings would not have the .trim() method, so the code: navigator.userAgent.trim() would not work since navigator.userAgent was defined before you added your trim() method.

    And that article is just Tim being anal and paranoid. Ignore it 🙂 As long as you don’t forget to type new myClass() instead of just myClass(), you won’t have any issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an osgi application (in felix) with multiple bundles. There are some common
I am using Apache Felix and its Declarative Services (SCR) to wire the service
I am trying to to build a Felix bundle in Eclipse. This basically includes
I'm trying to start a Wicket Application using Felix implementation of OSGi HTTP service,
I'm about to star an OSGI project using netbeans 6.8 and felix 2.0.4; can
Using Apache Felix, I have an OSGi component I've authored that wraps some middleware
I'm looking to do some development with Apache Felix , and I'm curious what
Is it possible to use spring inside war bundle on felix? I use spring
I can't find information about starting and using Apache Felix from code. I want
The Eclipselink OSGi bundles seem have trouble working in some OSGi containers, notably Felix,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.