Record collection not working

Tell us what’s happening:
All of the requirements of the challenge are being met except for two of them. I made a comment above the last two else if statements pointing to the problem. I can’t seem to push value to the end of the array for object 2468, nor can I delete the "tracks property for 2548.

I was able to solve this challenge with the second solution hint, but it looked unfamiliar to me compared to what I have learned so far. I want to make what I have done work. Thanks for helping.

Your code so far

// Setup
var collection = {
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(object, id, prop, value) {
if (prop !== "tracks" && value !== "") {
  object[id][prop] = value;

} else if (prop === "tracks" && !object[id].hasOwnProperty["tracks"]) {
  object[id][prop] = [];

  // These next to else if statements are giving me issues.

} else if (prop === "tracks" && value !== "") { 

} else if (value === "") {
  delete object[id][prop];
return object;

updateRecords(collection, 5439, 'artist', 'ABBA');

Your browser information:

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

Challenge: Record Collection

Link to the challenge:

is this the correct syntax?

No, you’re right. It should be object[id].hasOwnProperty(“tracks”). I will fix this and then see what I have.

Thanks, I changed the line you pointed out and the line:


by taking out [0] and that solved it.