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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:52:08+00:00 2026-05-18T03:52:08+00:00

Even though I have read a lot about it I can’t get my head

  • 0

Even though I have read a lot about it I can’t get my head around the prototype concept.

Why is there a String and String.prototype?

If I have "cat":

  • Is that a String or an Object?
  • Does it inherits all properties/methods from String or String.prototype?
  • Why is there a String and String.prototype?
  • Should I call String the String object and String.prototype the String prototype?

Please bring clarity to this.

  • 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-18T03:52:08+00:00Added an answer on May 18, 2026 at 3:52 am

    I’m answering this because there is a lot of misinformation in the subject:

    Is that a String or an Object?

    No "cat" is a primitive String value:

    typeof "cat"; // "string", a String value
    "cat" instanceof String; // false
    
    
    typeof new String("cat"); // "object", a String object
    new String("cat") instanceof String; // true
    

    I will talk later on about types and primitive values.

    Does it inherits all properties/methods from String or String.prototype?

    Well, when you use the property accessor operator (the dot or the bracket notation), the primitive value is implicitly converted to object, internally, therefore all the methods on String.prototype are available, for example:

    When you access:

    "cat".chatAt(0);
    

    Behind the scenes "cat" is converted to object:

    Object("cat").chatAt(0);
    

    That’s why you have access to all the inherited properties on values.

    Why is there a String and String.prototype?

    String is a constructor function, allows you to create String objects or do type conversion:

    var stringObj = new String("foo"); // String object
    
    // Type conversion
    var myObj = { toString: function () { return "foo!"; } };
    
    alert(String(myObj)); // "foo!"
    

    The String.prototype object, is the object where String object instances inherit from.

    I know it’s confusing, we have String values and String objects, but most of the time you actually work only with string values, don’t worry for now about String objects.

    Should I call String the String object and String.prototype the String prototype?

    You should call String “The String constructor”.

    “String prototype” is ok.

    You should know that “Everything is NOT an object”.

    Let’s talk about types, there are five language types specified:

    • String
    • Number
    • Boolean
    • Null
    • Undefined

    A primitive value is ” a datum that is represented directly at the lowest level of the language implementation”, the simplest piece of information you can have.

    The values of the previously described types can be:

    • Null: The value null.
    • Undefined: The value undefined.
    • Number: All numbers, such as 0, 3.1416, 1000, etc.. Also NaN, and Infinity.
    • Boolean: The values true and false.
    • String: Every string, such as "cat" and "bar".
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Even though I have a robust and fast computer (Pentium Dual Core 2.0 with
I saw that __VIEWSTATE field gets rendered even though I have set the EnableViewState=false
I normally store all my configs in the registry. Even though I have started
Even though I've been a developer for awhile I've been lucky enough to have
I have code in an Update Panel and even though on a button click
I have used the XML Parser before, and even though it worked OK, I
One of my co-workers claims that even though the execution path is cached, there
How does container object like vector in stl get destroyed even though they are
Even though I always strive for complete validation these days, I often wonder if
Even though MDI is considered harmful , several applications (even MS Office, Adobe apps)

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.