String startsWith() and endsWith()
Widely available
The startsWith()
and endsWith()
methods of strings returns whether a search string appears at the beginning or end of the provided string.
Compatibility
- Chrome 41 Released on 2015-03-03
- Chrome Android 36 Released on 2014-07-16
- Edge 12 Released on 2015-07-29
- Firefox 17 Released on 2012-11-20
- Firefox for Android 17 Released on 2012-11-20
- Safari 9 Released on 2015-09-30
- Safari on iOS 9 Released on 2015-09-16
MDN docs
Specifications
- ECMAScript Language Specification, from TC39 (Ecma International).