Changes

Jump to: navigation, search

JavaScript String Object

642 bytes added, 18:39, 27 April 2007
JavaScript String Object Examples
== JavaScript String Object Examples ==
Now that we are familiar with the methods and properties provided with the String object it is time to look at some examples. Before beginning it is important to understand that the String Object methods do not modify the string contained in the object itself. Rather, a modified string is returned, leaving the original String object untouched. After the following script fragment fragment is executed: <pre> myString = new String ("This is my string");var upperCase = myString.toUpperCase(); </pre> myString still contains "This is my string". What the toUpperCase() method did was return the string converted to uppercase which was then assigned to variable ''upperCase''. Therefore, the value of the string variable ''upperCase'' is now "THIS IS MY STRING".
=== Getting the length of a String Object ===

Navigation menu