updateRecords is not registering as a function. I have scanned it myself, compared to other students’ arrow function syntax who were passing the same tests I am failing, ran it through a validator and had it analyzed by AI, all of which claimed it was, in fact, a function. I have also refreshed the page.
let 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'
}
};
const updateRecords = (records, id, prop, value) => {
if (value === "") {
delete records[id][prop];
return records;
}
else if (prop !== "tracks" && value !== "") {
records[id][prop] = value;
return records;
}
else if (prop === "tracks" && value !== "" && !records[id].hasOwnProperty("tracks"))
{
records[id][prop] = [];
records[id][prop].push(value);
return records;
}
else if (prop === "tracks" && value !== "") {
let update = records[id][prop];
update.push(value);
return records;
}
}
Your solution works from my end. Please try one of the following steps to move forward.
Click on the “Restart Step” button and force a refresh of your page with CTRL + F5 then try to paste the code in again.
or - Try the step in incognito or private mode.
or - Disable any/all extensions that interface with the freeCodeCamp website (such as Dark Mode, Ad Blockers, or Spellcheckers), and set your browser zoom level to 100%. Both of these factors can cause tests to fail erroneously.
or - Ensure your browser is up-to-date or try a different browser.