Strings: Task 2


In this task you are provide with two variables, quote and substring, which contain two strings.

  1. Retrieve the length of the quote and store it in a variable called quoteLength.
  2. Find the index position where substring appears in quote, and store that value in a variable called index (remember, this is a numerical value).
  3. Use a combination of the variables you have and available string properties/methods to trim down the original quote to "I do not like green eggs and ham.", and store it in a variable named revisedQuote.
    Hint: Keep in mind, the slice "functions" on numerical values or the "equivalents" thereof (such as variables).
  4. Ensure the "." after "ham" is included in your new quote.