Strings

Strings as we've seen are lists of characters enclosed in quotes (single (') or double quotes (").)

Each character in the string can be accessed individually by specifying the integer index inside of []'s that are appended to the variable name or string constant. i.e:
str[i]
or:
"abc"[i]
The first character in a string is at index 0, the second at index 1, etc. If the index is negative or beyond the length of the string the result is "undefined", i.e.:

var str = "abc"; str[3] === undefined;

The length property gives the number of characters in the string:

var a = "ten letters"; console.log(a.length); // outputs 11.

Properties can be accessed on string constants:

"abc".length == 3;

Methods are functions that operate on the variable or constant:

var a = "one two three"; a.split(' ');
or:
"one two three".split(' ');

Makes an array: ["one", "two", "three"] where the string is "split" into words separated by the string passed to the split method.

a.split(""); // Breaks string in a into an array, one character per index.

.substr() method - extracts a sub-string:

"abcdefghi".substr(1,3) == "bcd"; // ^ Optional, if not present goes to the end of the string.