[Javascript] String method: endsWith() && startsWith()
2016-05-16 04:32
585 查看
With endsWith && startsWith, you can easily find out whether the string ends or starts with some other string:
example:
So you don't need to write regex any more.
example:
var str = "this is a new world" var startsWithRes = str.startsWith("this"); //true var endsWithRes = str.endsWith(world); // true
So you don't need to write regex any more.
相关文章推荐
- javascript 内部对象(1)——Math 对象
- 12个非常实用的JavaScript小技巧
- JavaScript 禁止复制与粘贴
- jq+ Js实现选项卡
- JS的并行加载与执行顺序
- JavaScript实现的9大排序算法
- JS的scrollIntoView
- JSP标签
- JSTL标签
- 手把手教你写电商爬虫-第四课 淘宝网商品爬虫自动JS渲染
- JSP 打印语句都能执行,但是断点却没有效果
- 关于javascript内存分配
- 点燃圣火! Ember.js 的初学者指南
- JS学习12(事件)
- Angular入门2
- js中getElementById()的用法
- javascript中定时器的使用
- 最全面的JavaScript调试技巧总结
- ExtJs 实现表单联动
- javascript的bom对象中的window对象