Trying to figure out how to get fade to work

Would you agree that Code 2 is an improvement over Code 1?

Code 1 https://jsfiddle.net/a7qfys9w/

allCovers.forEach(function addToPlayers(cover, index) {
      players.push({
        "cover": cover,
        "wrapper": (
          (index < allWrappers.length) ?
          allWrappers[index] :
          allWrappers[allWrappers.length - 1]
        )
      });
    });
  }

Code 2 https://jsfiddle.net/a7qfys9w/1/

        allCovers.forEach(function addToPlayers(cover, index) {
            const wrapper = allWrappers[
              Math.min(index, allWrappers.length - 1)
            ];
            players.push({
              cover,
              wrapper
            });

          });
        }

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