Suggestions, JavaScript Lesson 22 Substring


"some word".substring(x, y) where x is where you start chopping and y is where you finish chopping the original string.

There is some confusion here .. we dont actually start chopping on x we include x and we chop on y


Sub-strings work on the same principle as arrays and strings, which makes sense. They are offset based. The first position or index is 0, no offset. The rest comes from that..

text.substing(first_position_included, first_position_not_included);

Each one is an offset. The eigth character in "cosmic muffins" is, 'm'. Expressed as a sub-string,

"cosmic muffin".substring(7,8);