You are on the right track with the MDN site.
This is where I go if I want to look stuff up.
To answer your question, if you type "String" into the search box in the top right hand corner, the first two entries will be for
string - the function which converts the given argument to a string and
String - the global object.
If you click on the second two of these results, you can see all of String's properties and methods.
Open up the Console in Developer Tools in any browser. For strings native methods, type
You'll get a comprehensive hierarchical listing of every kind of property.
If you want a more in-depth look at the global object, type
What this means is that when you create a string variable
var s = "string";
inferred s type is String
var s = String("string");
var s = new String("string");
String.constructor method is called to create the value "string". s prototype's is now String.prototype, and s inherits those methods, including length.
This topic is now closed. New replies are no longer allowed.