Basic JavaScript - Record Collection

Tell us what’s happening:
Describe your issue in detail here.
Hello.
Can you help, please.
Looks like im stack on the last challenge.
After I put delete record [id][prop] have result: ```
updateRecords(recordCollection, 2548, “tracks”, “”)


,

tracks


should not be set // tests completed.

Meny thanks.


**Your code so far**


```javascript
// Setup
const 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!=="tracks" && value!==""){
   records[id][prop]= value;
  }else if(prop==="tracks"){
    records[id][prop]=records[id][prop]||[];
    records[id][prop].push(value);
  }else {
   delete records[id][prop];
    
  }
  return records;
}

updateRecords(recordCollection, 5439, "artist", "ABBA");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15

Challenge: Basic JavaScript - Record Collection

Link to the challenge:

Thank you very much. Did put:
else if(val===“”){
delete records[id][prop];
still have same problem.
Should I set prop first,then delete it?
Sorry if it sound silly, run out of ideas.
Regards.

Thank you so much.
I did change stack of orders and it is working !
Very appreciate your help.
Regards.

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