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 5946561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:50:24+00:00 2026-05-22T16:50:24+00:00

I asked the question: Why cant I declare a constructor instantiate an object and

  • 0

I asked the question:

Why cant I declare a constructor instantiate an object and then access the prototype?

And you can see that I have marked the answer. I understand the response but Im a bit confused as to what he means by:

The prototype belongs to the class, not the instance:

Does this mean that javascript has a class in this example? I thought javascript was classless? It only has function constructors… At what point does a function constructor become a class? Is it when you add other members to it using the .prototype accessor?

  • 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-22T16:50:25+00:00Added an answer on May 22, 2026 at 4:50 pm

    Actually class is an OOP term, not really javascript. What is meant is that the prototype belongs to the constructor. So in

    function MyConstructor(prop){
       this.foo = prop || 'foo';
    }
    MyConstructor.prototype.bar = 'allways bar';
    var mc1 = new MyConstructor('I am mc1'), 
        mc2 = new MyConstructor('I am mc2');
    
    alert(mc1.bar) ; //=> allways bar
    alert(mc2.bar) ; //=> allways bar
    alert(mc1.foo) ; //=> I am mc1
    alert(mc2.foo) ; //=> I am mc2
    

    bar belongs to the constructors (MyConstructor) prototype. It will always be ‘allways bar’, for every instance. foo is an instance property (with a default value ‘foo’) and can be assigned with a different value for every instance.

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

Sidebar

Related Questions

All right, so previously I asked... SOAP Prototype AJAX SOAPAction Header Question (can't hyperlink
I asked a question earlier about why left joins in Linq can't use defined
similar questions have been asked before but I cant find an exact match to
This question seems to be asked freqeuently over the internet but I still can't
It's quite possible a question like this has been asked before, but I can't
I have been repeatedly asked the following questions in many interviews.... But still can't
Alright. So I asked a question here but I feared that I anwsered it
This Question arises from a Q&A here I have some doubts that i think
I know this is a frequently asked question, however none of the solutions that
I know this is a question asked 12324 times probably, but I still can't

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.