# Javascript - Record Collection Exercise

**URL:** <https://forum.freecodecamp.org/t/javascript-record-collection-exercise/40027>\
**Category:** General\
**Created:** [September 25, 2016, 6:56pm UTC](https://forum.freecodecamp.org/t/javascript-record-collection-exercise/40027 "2016-09-25T18:56:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcoOliva](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@MarcoOliva](https://forum.freecodecamp.org/u/MarcoOliva)\
**Post date:** [September 25, 2016, 6:56pm UTC](https://forum.freecodecamp.org/t/javascript-record-collection-exercise/40027/1 "2016-09-25T18:56:01Z")

</div>

Hello!

I can’t find what is wrong with the code.

**Errors:**

- After updateRecords(2548, “artist”, “”), artist should not be set

- After updateRecords(2548, “tracks”, “”), tracks should not be set

**Code:**

function updateRecords(id, prop, value) {

if (prop !== “tracks” && value !== null) {  
collection[id][prop] = value;  
}

else if (prop === “tracks” && !(collection[id].tracks)) {  
collection[id][prop] = [value];  
}

else if (prop === “tracks” && value !== null) {  
collection[id][prop].push(value);  
}

else if (value === null) {  
delete collection[id][prop];  
}

return collection;  
}

---

<div class="post-metadata">

**Author:** ![ghostrider](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ghostrider/32/19759_2.png) [@ghostrider](https://forum.freecodecamp.org/u/ghostrider)\
**Post date:** [October 20, 2016, 11:06am UTC](https://forum.freecodecamp.org/t/javascript-record-collection-exercise/40027/3 "2016-10-20T11:06:59Z")

</div>

Try using “” instead of null 🙂

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [January 16, 2021, 5:30am UTC](https://forum.freecodecamp.org/t/javascript-record-collection-exercise/40027/4 "2021-01-16T05:30:44Z")

</div>

Closed on January 16, 2021, 5:30am UTC


