Working code doesn't get validated[Solved]

Hello people,
checking the output of my code with the console.log() it seems to me that everything is right but the code does not get validated.
Am i missing something ?
Thanks for your time.

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: [
      "Little Red Corvette"
  1245: {
    artist: "Robert Palmer",
    tracks: [ ]
  5439: {
    album: "ABBA Gold"

// Only change code below this line
function updateRecords(id, prop, value) {
var item = collection[id];
var theProp = item[prop]
if( prop != "tracks" && value != ""){
  item[prop] = value;

else if(prop == "tracks" && typeof theProp == 'undefined'){
  item.tracks = [value];
else if( prop == "tracks" &&  value != ''){

else if( value == ""){
  delete item[prop];
  return collection;

updateRecords(5439, "artist", "ABBA");
updateRecords(5439, "tracks", "Take a Chance on Me");
updateRecords(2548, "artist", "");
updateRecords(1245, "tracks", "Addicted to Love");
updateRecords(2468, "tracks", "Free");
updateRecords(2548, "tracks", "");
updateRecords(1245, "album", "Riptide");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0.

Challenge: Record Collection

Link to the challenge:

Seems to be working fine for me … try to clear browser cache and try again or different browser or just refresh and try

None of this solutions worked.
Well, the important thing is that my code work. I guess i’ll just take somebody else solution to get the exercice validated.

erratum : removing calls to updateRecords() at the end of the code got it validated.

1 Like