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

The Archive Base Latest Questions

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

I am newbie to javascript and oops. I have a javascript function function foo(args){

  • 0

I am newbie to javascript and oops. I have a javascript function

function foo(args){

   ...
}


//mehtod1
var type1=foo(a);

//mehtod2
var type2= new foo(a);

Now my doubt is which will give us more performance mehtod1 or method2

what is the significance of new keyword and what are the advantages over mehtod1?

(sorry if the question already exists and for my poor english)

  • 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-11T21:36:50+00:00Added an answer on June 11, 2026 at 9:36 pm

    The first call performs one operation: function evaluation. The second performs two: creates a new object and then does a function evaluation. Don’t use new to evaluate a function.

    Here is an example:

    var x = function () { return true; };
    
    var y = x(); // Type of y is boolean
    var y = new x; // Type of y is object
    var y = new x(); // Type of y is object
    var y = x; // Type of y is a function
    var y = x.call(this); // Type of y is a boolean
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A JavaScript newbie here. I have this following code: function testObject(elem) { this.test =
I'm a newbie in JavaScript. I have a function that is supposed to loop
I am a newbie at Javascript and Jquery. I have a form that I
First: I'm JavaScript newbie. So.. I have basic form with password, repeat password, email
Super newbie at Javascript here. I have a problem with whitespace that I'm hoping
I'm totally newbie in javascript/jQuery and i have a little problem :) I'm using
Newbie in javascript.. Need a little help. I have a SPAN or IMG that
I am a javascript newbie so bear with me. I have lists as so:
As a newbie to javascript I am trying to code a function that adds
I am newbie in javascript. i have one textBox and radioButton . if i

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.