here the test: console.log(updateRecords(collection, 5439, "tracks", "Take a Chance on Me"))
here the test result:
{ '1245': { artist: 'Robert Palmer', tracks: [] },
'2468':
{ albumTitle: '1999',
artist: 'Prince',
tracks: [ '1999', 'Little Red Corvette' ] },
'2548':
{ albumTitle: 'Slippery When Wet',
artist: 'Bon Jovi',
tracks: [ 'Let It Rock', 'You Give Love a Bad Name' ] },
'5439': { albumTitle: 'ABBA Gold', tracks: 'Take a Chance on Me' } }
but this is the given reult:
After updateRecords(collection, 5439, “tracks”, “Take a Chance on Me”), tracks should have Take a Chance on Me as the last element.
What do you think .hasOwnProperty(...) does? More specifically, what does it return?
With that information, will that return value ever equal "tracks"?
In the next if, you’re saying “if the property actually already exists…” - is this what the lesson calls for?
This is a case where i strongly suggest writing pseudocode. Write out, in your own words and in painful detail, what the program should do. Break it down to very small, discrete steps. Right now, your code seems to be trying to do too many things at once.
Snowmonkey, muchas gracias for the time that you spended on it!
I do not know the answer, yet, but i will apply the things that you said and the pseudocode as well.
Hola, again.
Here’s my solution. I know it’s not the best way to do it, but works!
I wanna say again muchas gracias to Snowmonkey and ieahleen for they time and the will to help me.