How to get a Javascript property

Where is an online reference for every kind of property for Javascript? In other words, the “length” property of string.length will point to the number of characters in a string (I think). So where are all the properties like this for strings? Where do I look them up?

For instance, if I go here, I’m not sure how to look them up: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference

I haven’t found any truly reliable online resources. I’m happier with a book, such as JavaScript: the Definitive Guide.

http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf - the original source where David Flanagan got the information needed to write JavaScript: the Definitive Guide.

Thank you both!

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

console.dir(String.prototype)

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

console.dir(window)

You’ll notice all the native objects, including those for the JavaScript types: Object, Array, String, Number, Boolean. Their prototype object lists the native methods. These native methods are available to every corresponding type you’ll use, primitive or reference. It’s called prototypal inheritance.

What this means is that when you create a string variable

var s = "string";

inferred s type is String

var s = String("string");

or

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.