# The Record Collection Exercise

**URL:** <https://forum.freecodecamp.org/t/the-record-collection-exercise/452422>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [March 22, 2021, 8:34pm UTC](https://forum.freecodecamp.org/t/the-record-collection-exercise/452422 "2021-03-22T20:34:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rayafry](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/rayafry/32/134407_2.png) [@rayafry](https://forum.freecodecamp.org/u/rayafry)\
**Post date:** [March 22, 2021, 8:34pm UTC](https://forum.freecodecamp.org/t/the-record-collection-exercise/452422/1 "2021-03-22T20:34:50Z")

</div>

Hi ,  
I have attempted this exercise but the code will not be accepted . The code is below:

function updateRecords(object, id, prop, value) {  
if(prop != “tracks” && value !=“”){  
collection[id][prop] = value;  
} else if(prop === “tracks” && collection[id][prop]=== undefined) {  
collection[id][prop] = [value];  
} else if (value === “”) {  
delete collection[id][prop]  
} else if (prop === “tracks”) {  
collection[id][prop].push(value);  
}

return collection;  
}

Can anyone assist?  
Thanks

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [March 22, 2021, 9:33pm UTC](https://forum.freecodecamp.org/t/the-record-collection-exercise/452422/2 "2021-03-22T21:33:24Z")

</div>

> [@rayafry](#):
>
> collection

You are using collection. You need to use the object passed into the function.

---

<div class="post-metadata">

**Author:** ![rayafry](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/rayafry/32/134407_2.png) [@rayafry](https://forum.freecodecamp.org/u/rayafry)\
**Post date:** [March 23, 2021, 12:15pm UTC](https://forum.freecodecamp.org/t/the-record-collection-exercise/452422/3 "2021-03-23T12:15:43Z")

</div>

Hi,

Thanks for your time and input. I have just completed the exercise, there were a few syntax additions I had to make before it passed.

Regards,  
Ray

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [September 22, 2021, 12:15am UTC](https://forum.freecodecamp.org/t/the-record-collection-exercise/452422/4 "2021-09-22T00:15:55Z")

</div>

Closed on September 22, 2021, 12:15am UTC

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