Record Collection problem

Tell us what’s happening:
one test case(mentioned while calling) is not passing

Your code so far

// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "Little Red Corvette" 
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    "5439": {
      "album": "ABBA Gold"
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
  else if(collection[id][prop] && value=="")
    delete collection[id][prop];
  return collection;

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");

In the case of updateRecords(5439, "tracks", "Take a Chance on Me")


is executing. That means that tracks is a string instead of an array.

if i am making it as array…then a differernt test case is creating issue updateRecords(5439, "artist", "ABBA");


tracks is a special case, so you’ll want to treat it differently than other possible values of prop.

oh ok ok! thanx, i got it now

i have posted two more doubts please have a look on them

Where? here i had asked

Can I use "[prop]’ instead of ‘collection[id][prop]’?

Not if id is a variable.

Can anyone explain what the function of  ! I do not understand this 
 Thanks for replying me

It returns the opposite Boolean value , it is the NOT operator. It also converts truthy and falsy values to their Boolean opposite

1 Like