Jump to content
Larry Ullman's Book Forums

sid9000k

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About sid9000k

  • Rank
    Newbie
  1. Dear Larry, On page 114 you introduced the indexOf() and lastIndexOf() method. At the bottom of the page you defined the variable fullName as 'Larry Ullman' then gave the following examples: var fullName = 'Larry Ullman'; fullName.indexOf('a'); // 1 ( I understand this one) fullName.lastIndexOf('a'); // 10 (I do not understand why you get 10?) I don't understand why it is 10? Shouldn't it be 1? If the search is backward, shouldn't it be 1? Also, since the string 'Larry Ullman' has two a's, does that mean that the lastIndexOf() method will give only the value of the first 'a' that it finds? This is probably a really stupid question but I am an absolute beginner who is just griding through your book. So far I really enjoy it. I figured it would be hard but I'm having fun reading it and going through the examples. thanks in advance, Sid9000K
×
×
  • Create New...