specific word count(index of)

specific word count (index of )

 
<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

转自:wusifan的博客
原文地址:https://www.cnblogs.com/190luo/p/10181897.html