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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:44:43+00:00 2026-06-01T03:44:43+00:00

In the following function, with a method inside of it called newlastname : function

  • 0

In the following function, with a method inside of it called newlastname :

function person(firstname,lastname,age,eyecolor)
{
  this.firstname=firstname;
  this.lastname=lastname;
  this.age=age;
  this.eyecolor=eyecolor;

  this.newlastname=newlastname;
}


function newlastname(new_lastname)
{
  this.lastname=new_lastname;
}

In the line this.newlastname=newlastname; what is happening? What does the first newlastname refer to? I appreciate any tips or advice.

  • 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-01T03:44:44+00:00Added an answer on June 1, 2026 at 3:44 am

    In this line of code:

    this.newlastname=newlastname;
    

    The first newlastname is a property on the person object.

    The second newlastname is a reference to the newlastname() function.

    So, when you do this:

    this.newlastname=newlastname;   
    

    you are storing a reference to that function in a property of the person object. That would allow the following code to work:

    var p = new person("Ted", "Smith", 31, "blonde");
    p.newlastname("Bundy");
    

    When you execute p.newlastname("Bundy");, it will look for a property on the person object called newlastname. When it finds that property, it will execute that function and pass it "Bundy" and set this to be the particular person object.

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

Sidebar

Related Questions

I have following method having following line inside it HtmlPage.Window.Invoke(showPopUp,new string[] {Hello from Silverlight});
Given the following Flash method: function sendToJava(name:String, ... args) { ExternalInterface.call(sendCommand, name, args); }
I have the following javascript method: function 123_test_function(){ } The function is generated by
I have the following serialization method: Private Function SerializeData(ByVal data As cData) As String
What I'd like to do is something like the following: FooClass.prototype.method = function():String {
What is the difference between the following two declarations? Class.method = function () {
I've the following method which allows me to protect MySQL entities: public function Tick($string)
Let's say we have the following method declaration: Public Function MyMethod(ByVal param1 As Integer,
Eg. I have following delegate method I want to use as a callback function
i would like to run a function method of a class inside another function

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.