Suggestion for possible change to Record Collection instructions

The current rules for the Record Collection challenge are:

  • Your function must always return the entire record collection object.
  • If prop isn’t tracks and value isn’t an empty string, update or set that album’s prop to value.
  • If prop is tracks but the album doesn’t have a tracks property, create an empty array and add value to it.
  • If prop is tracks and value isn’t an empty string, add value to the end of the album’s existing tracks array.
  • If value is an empty string, delete the given prop property from the album.

I was wondering if it would make sense to simplify the wording and the logic of users’ code by moving the last rule to be the 2nd and changing the existing 2nd rule to not talk about value not being an empty string. These changes would not affect the tests but the algorithm would be simpler and the challenge be less wordy. Also, since we have taught users what assign means and not set, make we should replace set with assign here too.

My suggestion:

  • Your function must always return the entire record collection object.
  • If value is an empty string, delete the given prop property from the album.
  • If prop isn’t tracks, update or assign that album’s prop to value.
  • If prop is tracks but the album doesn’t have a tracks property, create an empty array and add value to it.
  • If prop is tracks and value isn’t an empty string, add value to the end of the album’s existing tracks array.

We should really turn the comments from your last thread into changes: