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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:17:01+00:00 2026-05-30T18:17:01+00:00

Code snippet is following, Can anyone explain why a.hasOwnProperty(prototype) is true, the others are

  • 0

Code snippet is following, Can anyone explain why a.hasOwnProperty("prototype") is true, the others are false? Does it mean function has its own prototype, the others are inherited from Object?If so, why c.hasOwnProperty("prototype") is false? Besides, where does property of their constructor property come from? Thanks

    var a = function () {
    };
    var b = new String("test");
    var c = {};

    console.log(a.hasOwnProperty("prototype"));//true
    console.log(b.hasOwnProperty("prototype"));//false
    console.log(c.hasOwnProperty("prototype"));//false
    console.log(a.hasOwnProperty("constructor"));//false
    console.log(b.hasOwnProperty("constructor"));//false
    console.log(c.hasOwnProperty("constructor"));//false
    console.log(a.constructor);//Function()
    console.log(b.constructor);//String()
    console.log(c.constructor);//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-05-30T18:17:03+00:00Added an answer on May 30, 2026 at 6:17 pm

    The prototype property is only available on a constructor function. ‘a’ is a function and thus has a prototype. ‘b’ and ‘c’ are instances. They do not have prototypes, their constructors have prototypes:

    console.log(a.constructor.hasOwnProperty("prototype")) // true
    console.log(b.constructor.hasOwnProperty("prototype")) // true
    console.log(c.constructor.hasOwnProperty("prototype")) // true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the following code is a textmate javascript snippet, can anyone explain it please? cuz
Can someone explain the following code snippet for me? // Bind base object so
How can I make sure in the following code snippet that IDataReader is disposed
Can anyone provide a Code Snippet, Tutorial link or information on how to create
I've got the following code snippet. function addLinks () { for (var i=0, link;
Someone has given me the following C++ code snippet to try out - and
Consider the following code snippet private void ProcessFile(string fullPath) { XmlTextReader rdr = new
Given the following code snippet from inside a method; NSBezierPath * tempPath = [NSBezierPath
Take the following code snippet: SPAttachmentCollection attachments = item.Attachments ; What exactly is SPAttachmentCollection
Consider the following code snippet: $beat = date('B'); // 1 beat = 86.4 seconds,

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.