My data object contains information about different files, each associated with a courseContentId.
{id: 1864,
courseContentId: 481,
fileName: GymMembership.jpg
}
{id: 1865,
courseContentId: 481,
fileName: Field.jpg
}
{id: 1866,
courseContentId: 482,
fileName: Track.jpg
}
I want to display these files separately based on their courseContentId by creating a new object. Here is my desired output:
{id: 1864,
courseContentId: 481,
fileName: GymMembership.jpg
}
{id: 1865,
courseContentId: 481,
fileName: Field.jpg
}
{id: 1866,
courseContentId: 482,
fileName: Track.jpg
}
Which type of JavaScript function would be best suited for achieving this?