Record Collection code not working

Record Collection code not working
0

#1
function updateRecords(id, prop, value) {
  if (prop === "tracks" && value !== " ") {
    collection[id][prop].push("");
  }
  else if (prop !== "tracks" && ) {
    value = collection[id][prop];
  }
  else if (value == " ") {
    delete collection[id][prop]
  }

  
  return collection;
}

Above is my code. Why is it not producing the correct results?


#2

It looks like you didn’t finish writing this line of code? Ends with && which is unexpected…


#3

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

Note: Backticks are not single quotes.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


#4

Can you help me with my questions??


#5

I’ve deleted that, but it is still not working.


#6

Are you supposed to return collection or value? (if you post a link to the challenge it would be helpful)

In the 2nd if statement you are setting value to something but you don’t do anything else with value so what is the purpose?
In the last if statement you compare value to " " but should you be comparing it to “” instead? (that is, will value have spaces or will it have nothing?)

Edit: if I recall correctly, you are missing a few of the requirements stated in the challenge. If you go through the instructions slowly, one by one, and make sure you have handled each case, your code will improve…