You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
362 B
13 lines
362 B
// Let us access the first character in 'JavaScript' string.
|
|
|
|
let string = 'JavaScript'
|
|
let firstLetter = string[0]
|
|
console.log(firstLetter) // J
|
|
let secondLetter = string[1] // a
|
|
let thirdLetter = string[2]
|
|
let lastLetter = string[9]
|
|
console.log(lastLetter) // t
|
|
let lastIndex = string.length - 1
|
|
console.log(lastIndex) // 9
|
|
console.log(string[lastIndex]) // t
|