首页 > Web开发 > 详细

lastIndexOf js

时间:2015-05-04 19:43:01      阅读:241      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!