Issues with understanding function's if statement

Hello, I’m kind of getting how to solve this challenge but I wanted to take a step back and really understand what’s happening.

Can someone please explain why the function won’t return the recordCollection with the albumTitle set to 13 instead of 12 as stated in the if statement even though the if statement is true? I’m pretty sure the issue is with the condition (alb === 12) but why?

  **Your code so far**

const  recordCollection = {
2548: {
  albumTitle: 12

function testEqual(record, id, alb) {
if (alb === 12) {
  record[id][alb]= value
return record

console.log(testEqual(recordCollection, 2548, "albumTitle", 13))
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36

Challenge: Record Collection

Link to the challenge:

Update: I noticed that I didnt have a value parameter so I just updated it to have one but it still has the same issue and nothing changed

It looks like you drastically changed the code you were given. I would reset the lesson because you have made changes that make it impossible for your code to work.

1 Like

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