Basic JavaScript: Record Collection is a Bad question for beginners

Tell us what’s happening:
This question is really bad for beginners , I tried solving it 50 different times , looking up different methods and asking questions on stack overflow (which doesnt help because they dont actually tell you the answer they just try to make you troubleshoot with stuff you dont know) and asking friends.

when I saw the video on how to solve it I almost quit even trying to learn ,

the way the question is worded makes the student think that you solve the problem in the order that the tasks are given ( just like every other question you get on every other lesson) but when I looked at the video the guy solves it from the bottom up which makes no sense given the format that the student has been seeing for 70 lessons.

in addition there are no lessons before that which give context into how the problem is actually solved. the links to the hints are useless.

I’m sorry for the rant, I’ve been trying to beat this problem for 2 weeks now and now I just feel like I havent learned anything at all . I went back through each problem for two weeks trying to solve it and nothing helped.

Your code so far


// Setup
var collection = {
2548: {
  album: "Slippery When Wet",
  artist: "Bon Jovi",
  tracks: [
    "Let It Rock",
    "You Give Love a Bad Name"
  ]
},
2468: {
  album: "1999",
  artist: "Prince",
  tracks: [
    "1999",
    "Little Red Corvette"
  ]
},
1245: {
  artist: "Robert Palmer",
  tracks: [ ]
},
5439: {
  album: "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; rv:74.0) Gecko/20100101 Firefox/74.0.

Challenge: Record Collection

Link to the challenge:

I did some web development many years ago and I think doing stuff like you did in this challenge is pretty typical stuff that you’d do a lot of in the real world. So you actually learned a lot.

It is ok to get stuck at some levels like this. It doesn’t mean you are not good enough for this challenge. But let me give you some hint.

Do not get stuck at some level more than you can afford to

It means if your goal is to find a web dev job in 1 or 2 years, then being stuck in this problem for 2 weeks is not a good idea. Always assess your time and act accordingly. It is ok to check out the solution if you feel you are stuck and you cannot see a way you can solve this. That is why hints sections are there. But always try to understand the solution and learn from it. Make your lost time worth it and move onto next challenge. Good luck

2 Likes

why can’t you do it in this way?
have you tried asking for help in the forum? we wouldn’t give you the answer, but we would help you step by step all the way if that’s what you need

you can certainly do it in the order provided

the way in the video needs a bit more experience

Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, if you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

Thank you.