The first parameter start is the starting index and the second parameter is the length of the substring. Since you’re string can’t have a negative length, you can’t use a negative number for the second parameter (you can use a negative number for the first parameter, though). Of course, that second parameter is optional, if you want the rest of the string.
1. A string is assigned an e-mail address.
3. The split() method creates an array, called namesarr, by splitting up a string into substrings based on some delimiter that marks where the string is split. This string is split using the @ sign as its delimiter.
4. The first element of the array, namesarr, that is created by the split() method is ecomputernotes, the user name portion of the e-mail address.
5. The second element of the array, namesarr, that is created by the split() method is gmail.com, the mail server and domain portion of the e-mail address.
6. The charAt() method returns the character found at a specified position within a string; in this example, position 0. Position 0 is the first character in the string, a letter e.
7. By giving the charAt() method the length of the string minus 1, the last character in the string is extracted, a letter m.