Ad
  • Custom User Avatar

    Each iteration will currently overwrite the value of var 'result'.

    • 'var x = y' --> y
    • 'x = z' --> z

    You need the '+=' operator:

    • 'var x += y' --> y
    • 'x += z' --> yz

    Thus you're not considering some conditions:

    • when adding the first name to 'result' you had to enter just the value, without any commas or ampersand;
    • names.length can be 1 or 0.

    Good luck and do your best!

  • Custom User Avatar

    The length of an object is one higher than the last index, since they are zero-indexed. i starts at the length of the object and this doesn't exist as an index. Example: length = 8, names[8].name -> returns undefined because there isn't an 8th index.