Put in order · Vibe coding with Claude Code course · Module 14: Pinterest clone

Sorting: The distributePins loop

Put in order the lines of the loop that distributes the pins among the columns:

Items to put in order

  • }
  • heights[shortest] += pin.height / pin.width;
  • const shortest = heights.indexOf(Math.min(...heights));
  • for (const pin of pins) {
  • columns[shortest].push(pin);

You can check the correct answer by solving this task in the CodeWorlds game.