码迷,mamicode.com
首页 > Web开发 > 详细

lastIndexOf js

时间:2015-05-04 19:45:58      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

-- 貌似直接就是lastindexof‘a‘ 就是a字符出现的最后的索引 --

<script type="text/javascript">
var str="Hello hello a world!"
document.write(str.lastIndexOf("World"))
document.write(str.lastIndexOf("orld"))
document.write(str.lastIndexOf("world"))
</script>
-------------

就是
stringObject.lastIndexOf(‘aaa‘)
就是返回aaa在stringObject中(从后面往前推)所在的索引号码
从0开始计数的。
如果在stringObject找不到aaa那就返回-1
-------------
http://www.w3school.com.cn/jsref/jsref_lastIndexOf.asp

lastIndexOf js

标签:

原文地址:http://www.cnblogs.com/qinqiu/p/4476791.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!