Record Collection need help with understanding

// Setup

var 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) {


function id(prop){

  if (id.hasOwnProperty(traks) != true)  id += "tracks: " +[track];

  else if (id.hasOwnProperty(artist) != true)  id += "artist: " + id[artist] ;

  else if (id.hasOwnProperty(albumTitle) != true)  id += "records: " +[albumTitle];

  else if (id.prop == "") delete id[prop];


return records;


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


i thought that function id(prop) will retern the absent properties to function but it does
n’t help with understanding

I think you have some serious misunderstandings.

I think you don’t understand the structure of the records object.

Why did you redefine id as a function with an argument named prop?

This isn’t how you use hasOwnProperty. You have called it on the function id which you have created, which is not valid. Even without this function problem, you need to call hasOwnProperty on an object but id is not an object.

Why are you trying to += something to id? That is not how you change, modify, or define a property on an object.

If id was an object, you couldn’t access the property prop by dot notation, because prop is a variable rather than the exact property name.

id isn’t an object, so you can’t delete here.

i thought id has value 1245 or 5439 or… and if this function is inside another function so this mean that properties of second the same :flushed:
like id is folder, and when i’m writing the way i can modify it when got accsess
i gess need more to reed about this before doing this lesson

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