Cuéntanos qué está pasando:
Hi everyone!
I’ve tried everything, but clearly without success.
I’m gonna show you my code, I think one of the problem is that I don’t know how to assign Tracks. I could assign out of the function…but I think they want me to put inside the condition.
I’ve seen a lot of codes on internet about this project, but since I don’t necessary understand them, I don’t want copy other’s solutions without understanding what is wrong. Is anyone out there that can explain to me or giving any hints to me?
Not only I’m doing this course but before doing any exercise on Freecodecamp, I study their videos on Youtube and I take notes and think, a lot.
But despite that, I don’t understand. In their video, this exercise is different, now I’m trying to apply logic but since I started to coding just 2 month ago , I don’t even know if I have the knowledge to solve this problem.
Help ¯_( ͡❛ ͜ʖ ͡❛)_/¯ me !
It’s Holy Week and I need to solve this before going on holiday:)
Tu código hasta el momento
// Configuración
const recordCollection = {
2548: {
albumTitle: 'Slippery When Wet',
artist: 'Bon Jovi',
tracks: ['Let It Rock', 'You Give Love a Bad Name']
},
2468: {
albumTitle: '1999',
artist: 'Prince',
tracks: ['1999', 'Little Red Corvette']
},
1245: {
artist: 'Robert Palmer',
tracks: []
},
5439: {
albumTitle: 'ABBA Gold'
}
};
// Cambia solo el código debajo de esta línea
function updateRecords(records, id, prop, value) {
if (prop !== tracks && value !== "") {
records[id][prop] = value;
} else if (prop === tracks && value !== "") {
records[id][prop].push(value);
} else if (value === "") {
delete records[id][prop];
}
return records;
}
updateRecords(recordCollection, 5439, 'artist', 'ABBA');
Información de tu navegador:
El agente de usuario es: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Challenge: JavaScript básico - Colección de discos
Enlaza al desafío: