34,333
edits
Changes
→Creating a JavaScript String Object
</pre>
JavaScript String object methods and properties are accessed using the standard object dot notation:
''objectName.property'' accesses a property. For example:
<pre>
var stringLen = myString.length;
</pre>
returns the length of the string and assigns it to the variable ''stringLen''
Similarly:
<pre>
var position = myString.indexOf ("my");
</pre>
returns the postion index of the word ''my'' in the string (the word my begins position 8 because the first character is index position 0).