endsWith
优质
小牛编辑
131浏览
2023-12-01
Checks if this sequence ends with a given suffix.
Signature
StringLikeSequence.endsWith = function(suffix) { /*...*/ }
StringLikeSequence.endsWith = function endsWith(suffix) { return this.substring(this.length() - suffix.length).toString() === suffix; }
Name | Type(s) | Description |
---|---|---|
suffix | string | The suffix to check for. |
returns | boolean | Whether or not this sequence ends with |
Examples
Lazy('foo').endsWith('oo') // => true Lazy('foo').endsWith('') // => true Lazy('foo').endsWith('abc') // => false