Skip to main content

Char At

Module Info:

moduleType: "internal",
moduleName: "charAt"

Description

The charAt function receives a string and a number and returns character found at that numeric index. Do note however that the index for the first character is 0, the second is 1 and so on.

Inputs

NameTypeRequired
stringstring
indexnumber

Outputs

NameType
foundstring
notFoundMessagestring

The notFoundMessage property will only be defined if there is no character at the given index (index is out of bounds).

Examples

Inputs Outputs
string index found notFoundMessage
"abcde" 0 "a" undefined
"abcde" 2 "c" undefined
"abcde" 5 undefined "There is no character present at the given index"