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的博客
posted @ 2018-12-26 21:24  血色黎明  阅读(127)  评论(0编辑  收藏  举报