我是靠谱客的博主 迅速电话,这篇文章主要介绍字符串endsWith()方法,现在分享给大家,希望可以做个参考。

Check if a string ends with the value of the string passed as parameter..

检查字符串是否以作为参数传递的字符串的值结尾。

复制代码
1
2
'JavaScript'.endsWith('Script') //true 'JavaScript'.endsWith('script') //false

You can pass a second parameter with an integer value and (if present) endsWith() will consider the original string as if it was long that many characters:

您可以传递带有整数值的第二个参数,并且(如果存在) endsWith()将认为原始字符串好像有那么多字符:

复制代码
1
2
'JavaScript'.endsWith('Script', 5) //false 'JavaScript'.endsWith('aS', 5) //true

It was introduced in ECMAScript 2015.

它在ECMAScript 2015中引入。

翻译自: https://flaviocopes.com/javascript-string-endswith/

最后

以上就是迅速电话最近收集整理的关于字符串endsWith()方法的全部内容,更多相关字符串endsWith()方法内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(91)

评论列表共有 0 条评论

立即
投稿
返回
顶部