It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
Hi @NoneCoder
It seems like your code does not satisfy the given conditions in the challenge. It’s like just changing property values.
So you need to write your code to fulfil the given conditions.
Try to undrestand the logic with the given conditions
function updateRecords(object, id, prop, value) {
// first condition
if(value != "" && prop != "tracks"){
// second condition
}else if(prop == "tracks" && !object[id].hasOwnProperty("tracks")){
// you have to create an array to store tracks.
// object[id][prop] = [] is an array, with the given property ( tracks )
// Now, try to insert the value that given as function's parameter, as the value
// of this array
// third condition
}else if(prop == "tracks" && value != ""){
// forth condition
}else if(value == ""){
}
return object;
}