Build a Playlist Remix Engine - Step 3

I’ve been struggling with this for a few days now. No matter what I try, the source array always says [Object].

const playlists = [
  [
    {
      trackId: "trk101",
      artist: "Velvet Comet",
      title: "Crimson Afterglow",
      votes: 5,
      bpm: 122
    },
    {
      trackId: "trk102",
      artist: "Neon Harbor",
      title: "Static Horizon",
      votes: 2,
      bpm: 108
    },
    {
      trackId: "trk103",
      artist: "Lunar Arcade",
      title: "Midnight Frequency",
      votes: 4,
      bpm: 128
    }
  ],
  [
    {
      trackId: "trk201",
      artist: "Solar Echo",
      title: "Glass Skyline",
      votes: 3,
      bpm: 115
    },
    {
      trackId: "trk202",
      artist: "Velvet Comet",
      title: "Satellite Hearts",
      votes: 6,
      bpm: 124
    }
  ]
];

function flattenPlaylists (playlist) {

  if (Array.isArray(playlist) == false) {
    return [];
  }

  for (let i = 0; i < playlist.length; i++) {
    for (let j = 0; j < playlist[i].length; j++) {

      playlist[i][j].source = [i, j]
    }
  }

  return playlist
} 

hello @shawdowdancer14 welcome to the forum!

A ‘flat array’ is basically an array that has no sub-arrays within it. In other words, a flat array is a one-dimensional array.

Your flattenPlaylists function should return a flat array. Currently it is just returning the modified version of the given input playlist array (which is supposed to be a 2D array), with source property added to each track/song.

Please do not mutate the input playlist array inside flattenPlaylists.

In the future, when you require assistance with a specific challenge, please try to include a link to the challenge. It helps to make the process of providing help easier. Thank you.