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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:28:37+00:00 2026-06-06T07:28:37+00:00

Function constructors are able to create objects in javascript but I have a more

  • 0

Function constructors are able to create objects in javascript but
I have a more basic question.

Declaring a plain function in Javascript using a “function declaration” such as

function Foo() 
{
  this.prop1 = 20;
  //some code
}

Does this create an object internally in javascript heap with pointer as abc and prop1 as 20?

Or is it that the objects are created only when the function constructor is called
like

var a = new Foo() //This definately creates a new object
  • 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-06T07:28:39+00:00Added an answer on June 6, 2026 at 7:28 am

    In javascript, all functions are objects.

    You can do things like this:

    function foo() {
        return true;
    }
    
    foo.greeting = "hello";
    foo.tone = "mean";
    foo.talk = function() {
        alert(foo.greeting);
    }
    
    foo.talk();
    

    A function object has all the same capabilities as a normal javascript object, but it can also do some additional things such as be used as a constructor and it has a few built-in properties. See the MDN page on Function objects for a description of the other properties/methods it has.

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

Sidebar

Related Questions

I have lots of code like this in my constructors:- function __construct($params) { $this->property
I have two objects defined something like this (simplified for sake of the question):
I am using codeigniter 1.7.3 and I have controllers set up and working, but
I have a set of objects and I want to be able to use
I know how to use JSON to create objects, but there doesn't seem to
I want to create a constructor function in javascript, which has a .prototype property
I am trying to figure out how to call a javascript function using text
I' ve tried combining the module pattern with a constructor function but it seems
I'm trying to call an accessor function in a copy constructor but it's not
Well, I have a problem (ok, no real problem, but I wanna try out

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.