Javascript help needed

Tell us what’s happening:
Describe your issue in detail here.
After

updateRecords(recordCollection, 1245, “tracks”, “Addicted to Love”)

tracks should have the stringAddicted to Love as the last element.

Your code so far

      function updateRecords(records, id, prop, value) {
  
if (prop != 'tracks' && value!=""){
  records[id][prop] = value;
}
else if(prop === 'tracks' && records[id].hasOwnProperty('tracks')===false ){
records[id][prop] = [value];
}

else if(prop === 'tracks' && value !==""){
records[id][prop].push[value];

}

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

**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36

Challenge: Record Collection

Link to the challenge:

Hey there,

It looks like the post template got a little malformed, so I edited your post to fix it. :slight_smile:

Okay, now that I’ve looked at the code, I see you have a small syntax error here. Once you fix that, the tests should pass.

Hint just in case it is needed

push is a function() not an arr[]

1 Like

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