Returns the substring at the specified location within a String object.
|
---|
strVariable.substring(start, end)
"String Literal".substring(start, end) |
Arguments
-
start
-
The zero-based index integer indicating the beginning of the substring.
-
end
-
The zero-based index integer indicating the end of the substring.
Remarks
Example
The following example illustrates the use of the substring method.
| Copy Code |
---|
function SubstringDemo(){
var ss; //Declare variables.
var s = "The rain in Spain falls mainly in the plain..";
ss = s.substring(12, 17); //Get substring.
return(ss); //Return substring.
} |
Requirements
See Also