当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

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);
}
NameType(s)Description
inumber

The index of this sequence.

returnsstring

The character at the specified index.

Examples

Lazy("foo").charAt(0)  // => "f"
Lazy("foo").charAt(-1) // => ""
Lazy("foo").charAt(10) // => ""