Array 对象用于在单个的变量中存储多个值。
stringObject.indexOf(searchvalue,fromindex)
<script type="text/javascript">
var str="Hello world!"
document.write(str.indexOf("Hello") + "<br />")
document.write(str.indexOf("World") + "<br />")
document.write(str.indexOf("world"))
</script>
以上代码的输出:
0
-1
6