0👍
Simply you can make a function to check if selected music with id already in list.
isAlreadyAdded(id, arr) {
let is_in = false;
for (let i = 0; i < arr.length; i++) {
if (arr[i].id === id) {
is_in = true;
break;
}
}
return is_in;
}
Source:stackexchange.com