Basic JS. Something wrong with my understanding?

Tell us what’s happening:
Describe your issue in detail here.
Please point out my mistakes and brush up my logic.

   **Your code so far**

// Setup
var 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'

// Only change code below this line
function updateRecords(records, id, prop, value) {

if(prop !== records[id].tracks && value != null){

 records[id][prop] = value;
else if (prop == records[id].tracks && records[id].hasOwnProperty(tracks) == false) {
 records[id][prop] = [value]; 

else if(prop == records[id].tracks && value != null ){
else if(value === null){
   delete records[id][prop];
 return records;

updateRecords(recordCollection, 5439, 'artist', 'ABBA');
   **Your browser information:**

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:88.0) Gecko/20100101 Firefox/88.0

Challenge: Record Collection

Link to the challenge:

A few things.

For here
records[id].tracks we want to access the key tracks.

For here

We want to see if value is or is not an empty string.

For here, you need to double check the proper syntax.

Look carefully at the ending with [tracks]. You are missing something important around tracks.
If you need help you can review bracket notation here

For here
Double check for correct syntax
You missing something around tracks

I think I got it all. :grinning:


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.