Problem with "Basic JavaScript: Record Collection" - function psuh() undefined

Hi, I have a little problem; the console say to me that the function .push() doesn’t exist…

Thank you for your help!!!

Would you mind pasting actual code, instead of a screenshot? It will make it easier for me to copy/paste specific lines to reference in a reply?

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.

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

Note: Backticks are not single quotes.


FYI - In the future, if you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

Thank you for your answer! I clicked the Ask for Help button of this challenge… But I didn’t have a topic like you said haha sorry!

And here is my code :slight_smile:

// 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) {
  if(prop != "tracks" && value != "") {
    collection[id][prop] = value;
  else if(prop === "tracks" && value != "") {
    if(!collection[id][prop]) {
      collection[id][prop] = value;
  else if(value == "") {
    delete collection[id][prop];
  return collection;

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

In the above code segment, if prop is “tracks” and value is not an empty string, then you check if the object has a prop property. If it does not exist, you assign value to it. Then in the last line, you push value to that same property. So, let’s say the first if statement condition is met and the inner if statement condition is met. Because there happens to be no “tracks” property yet. your code is going to assign a string to a “tracks” property and then the last line will attempt to push that same value to the “tracks” property. To use push, the value of “tracks” must be an array and not a string, which is why you get an error on one of the test cases. You need to adjust your inner if statement code block to assign a different value. What value should you be assign it, so the push line works accordingly?