Make your own free website on Tripod.com

Javascript Tutorial Part 9

myitcareer.org-Your IT Career Partner For Life. Please Bookmark It.
Homework Help | Buy Book | Buy Phone | Top Web Hosts | Hire Web Designer
Home | Interview Questions And Answers | Plan Wedding | Online Tuition
Top Domain Registrars | Hire Freelancer | Hosting Charges | Hindi News

The length() Method
Use the length property to find out how many character there is in the string. The indexOf() Method
Test if a string contains a specified character. Returns an integer if it does and -1 if it do not. Use this
method in a form validation. The match() Method
Works similar to the indexOf method, only this method returns the characters you specified, "null" if the
string do not contain the specified characters. The substr() Method
The substr method returns specified parts of the string. If you specify (14,7) the return will be the 14th
character and the next 7. Note that the first character is 0, the second is 1 etc. The toLowerCase() and toUpperCase() Methods
How to return a string in lower or upper case. The most common methods Methods Explanation NN IE ECMA length Returns the length of the string 2.0 3.0 1.0 indexOf() Returns the index of the first time the specified character occurs,
or -1 if it never occurs, so with that index you can determine if the
string contains the specified character. 2.0 3.0 lastIndexOf() Same as indexOf, only it starts from the right and moves left. 2.0 4.0 match() Behaves similar to indexOf and lastIndexOf, but the match
method returns the specified characters, or "null", instead of a
numeric value. 4.0 4.0 substr() Returns the characters you specified: (14,7) returns 7 characters,
from the 14th character. 4.0 4.0 substring() Returns the characters you specified: (14,7) returns all characters
between the 7th and the 14th. 2.0 3.0 1.0 toLowerCase() Returns the string in lower case 2.0 3.0 1.0 toUpperCase() Returns the string in upper case 2.0 3.0 1.0 The Array object Some times you want to assign more than one value to a single variable. Then you can create a variable
that can contain a series of values. This is called an array variable. The declaration of an array variable: names = new Array(3) The expecting number of elements goes inside the parentheses, in this case 3. You assign data to each of
the elements of the array like this: names[0] = "Tove"
names[1] = "Jani"
names[2] = "Ståle" Similarly, the data can be retrieved from any element using an index into the particular array element you
want. Like this:
Previous| Next