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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:23:48+00:00 2026-06-11T07:23:48+00:00

I am very new to javascript prototypes. So I am wondering If the following

  • 0

I am very new to javascript prototypes. So I am wondering If the following is legal and will always work :

function Obj(name) {
    this.name = name;
}
Obj.prototype.getName() {
   return this.name;
}

and then :

var obj1 = new Obj("one");
var obj2 = new Obj("two");
alert(obj1.getName() + " " + obj2.getName());

Will I get “one two”. I know this is a simple example, but will things like this always reference object instances or will this mean the prototype or an event. Thanks

  • 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-06-11T07:23:50+00:00Added an answer on June 11, 2026 at 7:23 am
    // Setup Obj    
    function Obj() {}
    Obj.prototype.me = function () {return this;}
    
    // Make some vars
    var a = new Obj(), b = new Obj();
    
    // find out what "this" is equal to
    a.me() === a; // true
    a.me() === b; // false
    b.me() === a; // false
    b.me() === b; // true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new to Javascript and was wondering why the following code will
I am very very new to JavaScript so sorry if this is really silly.
I'm very new to JavaScript in general so having trouble with this. Working with
I have this Javascript code I inherited from another developer. I am very new
Ok im new to javascript and Unity so this is clearly a very noob
I am using prototype and have the following javascript: function displayDefinition(term){ var term_id =
im very new at javascript so, this is the question. I need to make
I am very new to JavaScript and need to use callback function in my
Very new to javascript and html-type stuff. I wanted to just make a quick
I'm very new to Javascript (and jQuery). My JSFiddle really shows the issue in

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.