Chapter 12Handling Strings

Strings are an important part of any programming language. Whether you are storing a person’s last name or the name of a product in inventory, a string is often the best way to store that value. But what is a string really? Essentially, a string is simply an array of individual characters. This is true in all programming languages. Some languages, such as C and JavaScript, have you deal directly with the array of characters, while other languages, such as Visual Basic, hide that level of detail from the programmer. Each character has its position, or index. The indexing of strings, like that of arrays, is zero-based. The index of the first character of a string is 0, the index of the second one is 1, that of the third ...

Get Advanced Javascript, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.