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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:45:50+00:00 2026-06-06T23:45:50+00:00

function MyArray() { var self = this.arguments; //<— this.toString = function() { return self;

  • 0
function MyArray() {
    var self = this.arguments; //<---
    this.toString = function() {
        return self;
    };

}

var c = new MyArray(2, 3, 1, '232');
console.log(c.toString());

undefined

function MyArray() {
    var self = arguments; //<---
    this.toString = function() {
        return self;
    };

}

var c = new MyArray(2, 3, 1, '232');
console.log(c.toString());

[2,3,1,’232′]

So, why is that so? What is the difference between this.arguments and arguments?

  • 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-06T23:45:52+00:00Added an answer on June 6, 2026 at 11:45 pm

    In JS, this represents “calling context”, which can be set a number of different ways. It has really nothing to do with variable scope. They’re entirely separate concepts. That’s why arguments is available as a variable, but not a property of this.

    The value of this varies based on how a function is called.


    Called as a method

    For example, if I do…

    my_obj.myMethod();
    

    …then this will refer to my_obj because the function myMethod was called from the context of my_obj.


    Called independently as a function

    but if I do…

    var m = my_obj.myMethod;
    m();
    

    Even though my_obj and myMethod are the same code as the first example, the value of this will usually change to the global object.


    Called using .call or .apply

    There are several other ways this can be set as well.

    m.call(my_other_obj, "more", "args");
    
    m.apply(my_other_obj, ["more", "args"]);
    

    Using .call or .apply, the first argument passed becomes the value of this. The difference between the two is how the rest of the arguments are passed.


    Created using .bind

    There’s also .bind() which takes arguments in the same manner as .call(), but creates and returns a new function with the this value and any other arguments permanently set.


    Called using the new operator

    The final way is when you call a function as a constructor. To do this, you use the new operator.

    var new_obj = new m;
    
    var new_obj = new obj.m;
    

    In both cases, the value of this will be a new object being constructed. YOu should never use new unless the function called has been set up to be used as a constructor.

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

Sidebar

Related Questions

I have this code: var myArray = new Array(); var counter = 0; function
function Person() {} Person.prototype.population = 0; Person.prototype.constructor = function(name) { this.name = name; console.log(Name:
I have the loop below: var myArray = []; $(this).children('a').each(function () { myArray.push($(this).attr('href')); });
function Apple(){ this.name=apple; } function Orange(){ this.name=orange; this.apple = new Apple(); this.apple.onCalled=function(){ alert(this.name); }
function getWindowsUserName() { var WinNetwork = new ActiveXObject(WScript.Network); var urlToSite = http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS= + WinNetwork.UserName;
function getWindowsUserName() { var WinNetwork = new ActiveXObject(WScript.Network); var urlToSite = createCustomURL(WinNetwork.UserName); document.getElementById(psyncLink).src =
function getUser() { FB.api('/me', function(response) { console.log('Response is '+response); alert('Your name is ' +
How this code works? any one help me to understand ? var myArray =
What am I doing wrong? Code: sample_txt.text = sat; var myArray:Array = new Array
I have these Javascript classes/code: function PageManager () { this.digital_channels = undefined; this.loadConfiguration =

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.