Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

charat javascript

// The charAt() method returns the character at a specified index (position) in a string.
// The index of the first character is 0, the second 1, ...
// The index of the last character is string length - 1

let text = "HELLO WORLD";
let letter = text.charAt(0); // H

let text = "HELLO WORLD";
let letter = text.charAt(1); // E

let text = "HELLO WORLD";
let letter = text.charAt(text.length-1); // D
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #charat #javascript
ADD COMMENT
Topic
Name
9+6 =