Basic JavaScript: Record Collection need help

Tell us what’s happening:

Hi! I am stuck at this exercise (2hs trying to path it) it is a nightmare, so i tried copping the tutorial explanation and i cant also pass it. Is the first time I was so much time with an exercise.

Can somebody help me?

Your code so far


// Setup
var collection = {
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'
}
};



// Only change code below this line
function updateRecords(id, prop, value) {
if (value === "") {
  delete collection[id][prop];
} else if (prop === "tracks") {
  collection[id][prop] = collection[id][prop] || [];
  collection[id][prop].push(value);
} else {
  collection[id][prop] = value;
}

return collection;
}

updateRecords(5439, 'artist', 'ABBA');

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Record Collection

Link to the challenge:

I think the challenge was updated at some point but the video was not updated nor removed.

Reset the code and try looking at the starting code again and pay close attention to the parameters and what is being returned.

If you need help with the code you can go to the hints page and look at the hints. It also has a solution you can look at if needed.


Edit: The video has been removed but the code has not landed in production yet

Hi mate for answering… But i dont get it, i stuck at this exercice.

I do what you said about going to the hints but i have the same problem, noone of the hints was helpfull. I tried use them exactly an any have function right.

EDIT: and all the hints are from 2017, hope maybe something changes…

The hints are solution look up to date to me.

What is your updated code?

don’t look at the answers, the first post is the one with current hints and solution

2 Likes

thanks!!! I didnt realized that!