Record Collection Return Problem

Hello. I am having the following problem: no matter what return has it always returns the whole collection instead. Even if I type return “Hello world” it returns the whole collection. I was wondering what could be the problem. Thank you in advance.

Could you post your code? It’s not possible to tell what the issue is without seeing it

Hello. That is my code. I haven’t changed anything. But every time I change the return statement it returns the whole collection instead. I have reset the code a few times but it is still the same. Any help would be appreciated. Thank you.

// 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) {
  return collection;

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

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


Don’t worry about what is shown in the black “fake console”. What shows in the console is based on how the tests run. When you write:

return 'Hello World';

be assured, that is what the function is returning.

Thank you for your reply. But when I delete the whole code and keep only the function with the return statement it says “ReferenceError: collection is not defined”. But how am I supposed to know if the changes I make inside the function work if it constantly returns the whole collection?
Thank you in advance.

Hi there, is it possible for you to explain what you are trying to achieve?

Also how did you modify the code to return “Hello World”?

You can not delete all the code. That is why the comments above say Only change code below this line. The tests which run behind-the-scenes use the variable collection and collectionCopy for testing purposes. When you delete them, you are going to get reference errors. If you want to see what your function is returning, then you will need to use a console.log statement and then look at your browser’s console (Ctrl+Shft+J if using Chrome on Windows).

For example, if you reset the code, so collection and collectionCopy are defined and wrote the following code, your browser console would show “Hello World!”.

function updateRecords(id, prop, value) {
  var collection = "Hello World!";
  return collection;

Don’t worry about what the black console on the FCC site shows, because as I explained above, it is not the real console.

1 Like

Thank you very much. It was really helpful. Have a good day.