6. 16. 1. String.indexOf() |
|
Syntax |
string.indexOf(string, num)
string.indexOf(string)
|
|
The indexOf() method returns the indexed start position of the string passed. |
You can specify an index, defined by num, to start your search for the string specified. |
This method is the same as the String.lastIndexOf() method, but it starts at the beginning of the string. |
<html>
<script language="JavaScript">
<!--
var myString = new String("Hello, World!");
document.write(myString.indexOf(" ") + '<br>');
document.write(myString.indexOf("l", 4));
document.close();
-->
</script>
</html>
|
|