charAt
优质
小牛编辑
134浏览
2023-12-01
Returns the character at the given index of this sequence, or the empty string if the specified index lies outside the bounds of the sequence.
Signature
StringLikeSequence.charAt = function(i) { /*...*/ }
StringLikeSequence.charAt = function charAt(i) { return this.get(i); }
Name | Type(s) | Description |
---|---|---|
i | number | The index of this sequence. |
returns | string | The character at the specified index. |
Examples
Lazy("foo").charAt(0) // => "f" Lazy("foo").charAt(-1) // => "" Lazy("foo").charAt(10) // => ""