This is a badly written assignment


This assignment is SO ambiguous and unclear. I am a programmer and it confused me. Maybe I was overthinking it. I want to add these notes here in hopes that it helps somebody:

  1. You are searching text for your name and some letters of your name must be in text for the assignment to accept.
  2. Your name can be in text more than once; it is okay if hits has your name in it more than once.
    3) The assignment accepts even if it doesn't find your full name. As long as it find some of the letters in sequence.

To rephrase the assignment: Loop through the text string looking for your name. If you start seeing it, start pushing those letters into hits. As long as it found some letters it will pass the test.


The only letter being matched is the first one. All occurrences will trigger the inner loop. Then only as many letters are in myName, regardless what they are, will get pushed onto the array.

You are right about it not accepting an empty hits array. There must be at least as many elements are there are letters in myName.

Some people have trouble understanding the instructions, but not everyone. it is more likely the concepts that are throwing them off. The lesson text in the first couple of lessons pretty much explains what is expected.


It can push characters more than the length of your name. For example, if your name is "bob" and the text is "bob is a fun bo bo bo" you would end up with [bobbobobo]


In truth, it would look like this:

[ 'b', 'o', 'b', 'b', 'o', ' ', 'b', 'o', ' ', 'b', 'o', undefined ]


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.