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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:30:10+00:00 2026-06-01T20:30:10+00:00

I have the following code in a non-browser environment (Titanium Studio) and I noticed

  • 0

I have the following code in a non-browser environment (Titanium Studio) and I noticed that both result1 and result2 work, return the same result, and are the same type (object).

Could you explain if they are different in any and how they are different?

In my case inside name1 there is no reference to the local context (no ‘this’ in there, just local variables) and I am trying to figure out if I should be writing all my code with or without ‘new’ when I have a situation like the one below.

var name1 = function(some_arg){
    // some stuff
    return result; // returns an object
}

var result1 = name1('some_value');
var result2 = new name1('some_value');

typeof(result1); // returns object
typeof(result2); // returns object

Thanks!

Edit Below: The original question was answered and I am now looking for a clarification on something related.

Code related to comment below:

function Name1 (name){
    this.name = name;
}
var version1 = new Name1('joey');
version1.name;

var Name2 = function(name){
    this.name = name
}
var version2 = new Name2('joey');
version2.name;

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-01T20:30:13+00:00Added an answer on June 1, 2026 at 8:30 pm

    this is bound to a new object when using new while it is bound to the global object when not using new. If you do not use this in the constructor function or any methods you add to your object, it indeed does not really matter – however, you should use it anyway or you’ll have a problem if you ever do use it.

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

Sidebar

Related Questions

On a Solaris 5.8 machine, I have the following code: [non-working code] char *buf;
I have the following code: The actual problem is the non-quoted code. I want
I have the following code which I stripped out of any non-essential lines to
I have the following Solution: SomeProject.Ria (non Silverlight code) SomeProject.Ria.Silverlight (Silverlight light code, namespace
I have the following code for my .htaccess file that I've picked up from
I have the following code snippet in an ASP.NET app (non Silverlight) string sText
I have the following simple javascript code, which handles the Return Key, I don't
My problem is related to Android. I have the following code (non-relevant parts omitted):
I have the following code, which captures some TCP Packets. But it requires that
I have the following code that I am using to send a message from

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.