References

String.charAt()

Leírás

Visszatér a String példány adott indexéhez (szám) tartozó karakterével.

Szintaxis

charAt(index)

Példa

const x = 'This is string'
 
console.log(x.chart(0))
// Expected output: "T"
 
console.log(x.chart(3))
// Expected output: "s"
 
const sentence = 'The quick brown fox jumps over the lazy dog.'
const index = 4
 
console.log(`The character at index ${index} is ${sentence.charAt(index)}`)
// Expected output: "The character at index 4 is q"
in this article
back to top