I getting one error in the record collection in java script

Tell us what’s happening:
Describe your issue in detail here.
i am getting error in this point.
please help me out

                        After updateRecords(recordCollection, 2468, "tracks", "Free"), tracks should have the string 1999 as the first element.

   **Your code so far**

// 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] === undefined)
 else if(prop === "tracks" && value !== "")
 else if(value === "")
delete records[id][prop];

 return records;

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

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

Challenge: Record Collection

Link to the challenge:

What do you think this particular bit of code is doing?

1 Like

when prop is tracks and value is not a string we are setting prop to value given by them

And what do the instructions ask you to do for this situation?

1 Like

so the instructions are saying me to add value to the end of the albums existing tracks array

Correct! So how do you add a value to the end of an existing array?

I think we can add siimply by their index or just by using push method

push would definitely be the approach I’d take. :slightly_smiling_face:

give me a sec I will try

Thank you man for helping me out I cleared the test.
once again tq so much.but I have one doubt.
why this line didn’t work

we are setting prop to value given by them

Like you mentioned earlier, that line is setting the tracks property to the value - it doesn’t work because it’s not what the instructions ask you to do.

got the point’
thank you so much for helping me out

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