Strings as Set of Characters
Explore how strings in JavaScript can be viewed as arrays of characters, each identified by an index. Learn to access individual characters using bracket notation and utilize loops like for and for-of to iterate over all characters in a string. This lesson builds foundational skills for manipulating and navigating strings effectively in your JavaScript programs.
We'll cover the following...
We'll cover the following...
Identifying a particular character
You may think of a string as an array of characters. Each character is identified by a number called an index, just as it does for an array. The same golden rules apply:
- The index of the first character in a string is