<p dir="auto">Challenge <a href="https://www.freecodecamp.com/challenges/record-collection#?solution=%0A%2F%2F%20Setup%0Avar%20collection%20%3D%20%7B%0A%20%20%20%20%222548%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%22Slippery%20When%20Wet%22%2C%0A%20%20%20%20%20%20%22artist%22%3A%20%22Bon%20Jovi%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%0A%20%20%20%20%20%20%20%20%22Let%20It%20Rock%22%2C%20%0A%20%20%20%20%20%20%20%20%22You%20Give%20Love%20a%20Bad%20Name%22%20%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%222468%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%221999%22%2C%0A%20%20%20%20%20%20%22artist%22%3A%20%22Prince%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%0A%20%20%20%20%20%20%20%20%221999%22%2C%20%0A%20%20%20%20%20%20%20%20%22Little%20Red%20Corvette%22%20%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%221245%22%3A%20%7B%0A%20%20%20%20%20%20%22artist%22%3A%20%22Robert%20Palmer%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%225439%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%22ABBA%20Gold%22%0A%20%20%20%20%7D%0A%7D%3B%0A%2F%2F%20Keep%20a%20copy%20of%20the%20collection%20for%20tests%0Avar%20collectionCopy%20%3D%20JSON.parse%28JSON.stringify%28collection%29%29%3B%0A%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0Afunction%20updateRecords%28id%2C%20prop%2C%20value%29%20%7B%0A%20%20%0A%20%0A%20%20if%28value%20!%3D%3D%20%22%22%26%26prop!%3D%22tracks%22%29%0A%20%20%20%20%7B%0A%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D%3Dvalue%3B%0A%20%20%20%20%7D%0A%20%20if%28value%20!%3D%3D%20%22%22%26%26prop%3D%3D%22tracks%22%29%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20if%28collection%5Bid%5D.hasOwnProperty%28prop%29%3D%3D%3Dtrue%29%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D.push%28value%29%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20else%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D%3D%5B%5D%3B%0A%20%20%20%20%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D.push%28value%29%3B%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20if%28value%3D%3D%3D%22%22%29%20delete%20collection%5Bid%5D%5Bprop%5D%3B%0A%20%20%0A%20%20%0Areturn%20collection%3B%0A%0A%20%20%20%7D%0A%0A%2F%2F%20Alter%20values%20below%20to%20test%20your%20code%0AupdateRecords%285439%2C%20%22artist%22%2C%20%22ABBA%22%29%3B%0A%0A" rel="nofollow">Record Collection</a> has an issue.</p>
<p dir="auto">The line:<br>
var collectionCopy = JSON.parse(stringify(collection));</p>
<p dir="auto">should be like this:<br>
var collectionCopy = JSON.parse(JSON.stringify(collection));</p>
<p dir="auto">Cause the challenge saids that we can only change the code below the line:<br>
function updateRecords(id, prop, value) {</p>
<p dir="auto">and the issue is above this line!</p>
<p dir="auto">Ps.: I didn't put the solution, just called atention to a issue that make the challenge impossible to be solved!</p>
<p dir="auto">User Agent is: <code class="notranslate">Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17</code>.<br>
Please describe how to reproduce this issue, and include links to screenshots if possible.</p>
<p dir="auto">My code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
// Setup
var collection = {
    &quot;2548&quot;: {
      &quot;album&quot;: &quot;Slippery When Wet&quot;,
      &quot;artist&quot;: &quot;Bon Jovi&quot;,
      &quot;tracks&quot;: [ 
        &quot;Let It Rock&quot;, 
        &quot;You Give Love a Bad Name&quot; 
      ]
    },
    &quot;2468&quot;: {
      &quot;album&quot;: &quot;1999&quot;,
      &quot;artist&quot;: &quot;Prince&quot;,
      &quot;tracks&quot;: [ 
        &quot;1999&quot;, 
        &quot;Little Red Corvette&quot; 
      ]
    },
    &quot;1245&quot;: {
      &quot;artist&quot;: &quot;Robert Palmer&quot;,
      &quot;tracks&quot;: [ ]
    },
    &quot;5439&quot;: {
      &quot;album&quot;: &quot;ABBA Gold&quot;
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {


return collection;

   }

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


//CORRECT WAY BELOW

// Setup
var collection = {
    &quot;2548&quot;: {
      &quot;album&quot;: &quot;Slippery When Wet&quot;,
      &quot;artist&quot;: &quot;Bon Jovi&quot;,
      &quot;tracks&quot;: [ 
        &quot;Let It Rock&quot;, 
        &quot;You Give Love a Bad Name&quot; 
      ]
    },
    &quot;2468&quot;: {
      &quot;album&quot;: &quot;1999&quot;,
      &quot;artist&quot;: &quot;Prince&quot;,
      &quot;tracks&quot;: [ 
        &quot;1999&quot;, 
        &quot;Little Red Corvette&quot; 
      ]
    },
    &quot;1245&quot;: {
      &quot;artist&quot;: &quot;Robert Palmer&quot;,
      &quot;tracks&quot;: [ ]
    },
    &quot;5439&quot;: {
      &quot;album&quot;: &quot;ABBA Gold&quot;
    }
};
// 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(value !== &quot;&quot;&amp;&amp;prop!=&quot;tracks&quot;)
    {
      collection[id][prop]=value;
    }


return collection;

   }

// Alter values below to test your code
updateRecords(5439, &quot;artist&quot;, &quot;ABBA&quot;);
"><pre class="notranslate"><span class="pl-c">// Setup</span>
<span class="pl-k">var</span> <span class="pl-s1">collection</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-s">"2548"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"album"</span>: <span class="pl-s">"Slippery When Wet"</span><span class="pl-kos">,</span>
      <span class="pl-s">"artist"</span>: <span class="pl-s">"Bon Jovi"</span><span class="pl-kos">,</span>
      <span class="pl-s">"tracks"</span>: <span class="pl-kos">[</span> 
        <span class="pl-s">"Let It Rock"</span><span class="pl-kos">,</span> 
        <span class="pl-s">"You Give Love a Bad Name"</span> 
      <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"2468"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"album"</span>: <span class="pl-s">"1999"</span><span class="pl-kos">,</span>
      <span class="pl-s">"artist"</span>: <span class="pl-s">"Prince"</span><span class="pl-kos">,</span>
      <span class="pl-s">"tracks"</span>: <span class="pl-kos">[</span> 
        <span class="pl-s">"1999"</span><span class="pl-kos">,</span> 
        <span class="pl-s">"Little Red Corvette"</span> 
      <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"1245"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"artist"</span>: <span class="pl-s">"Robert Palmer"</span><span class="pl-kos">,</span>
      <span class="pl-s">"tracks"</span>: <span class="pl-kos">[</span> <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"5439"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"album"</span>: <span class="pl-s">"ABBA Gold"</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-c">// Keep a copy of the collection for tests</span>
<span class="pl-k">var</span> <span class="pl-s1">collectionCopy</span> <span class="pl-c1">=</span> <span class="pl-c1">JSON</span><span class="pl-kos">.</span><span class="pl-en">parse</span><span class="pl-kos">(</span><span class="pl-en">stringify</span><span class="pl-kos">(</span><span class="pl-s1">collection</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// Only change code below this line</span>
<span class="pl-k">function</span> <span class="pl-en">updateRecords</span><span class="pl-kos">(</span><span class="pl-s1">id</span><span class="pl-kos">,</span> <span class="pl-s1">prop</span><span class="pl-kos">,</span> <span class="pl-s1">value</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>


<span class="pl-k">return</span> <span class="pl-s1">collection</span><span class="pl-kos">;</span>

   <span class="pl-kos">}</span>

<span class="pl-c">// Alter values below to test your code</span>
<span class="pl-en">updateRecords</span><span class="pl-kos">(</span><span class="pl-c1">5439</span><span class="pl-kos">,</span> <span class="pl-s">"artist"</span><span class="pl-kos">,</span> <span class="pl-s">"ABBA"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>


<span class="pl-c">//CORRECT WAY BELOW</span>

<span class="pl-c">// Setup</span>
<span class="pl-k">var</span> <span class="pl-s1">collection</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-s">"2548"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"album"</span>: <span class="pl-s">"Slippery When Wet"</span><span class="pl-kos">,</span>
      <span class="pl-s">"artist"</span>: <span class="pl-s">"Bon Jovi"</span><span class="pl-kos">,</span>
      <span class="pl-s">"tracks"</span>: <span class="pl-kos">[</span> 
        <span class="pl-s">"Let It Rock"</span><span class="pl-kos">,</span> 
        <span class="pl-s">"You Give Love a Bad Name"</span> 
      <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"2468"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"album"</span>: <span class="pl-s">"1999"</span><span class="pl-kos">,</span>
      <span class="pl-s">"artist"</span>: <span class="pl-s">"Prince"</span><span class="pl-kos">,</span>
      <span class="pl-s">"tracks"</span>: <span class="pl-kos">[</span> 
        <span class="pl-s">"1999"</span><span class="pl-kos">,</span> 
        <span class="pl-s">"Little Red Corvette"</span> 
      <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"1245"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"artist"</span>: <span class="pl-s">"Robert Palmer"</span><span class="pl-kos">,</span>
      <span class="pl-s">"tracks"</span>: <span class="pl-kos">[</span> <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"5439"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"album"</span>: <span class="pl-s">"ABBA Gold"</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-c">// Keep a copy of the collection for tests</span>
<span class="pl-k">var</span> <span class="pl-s1">collectionCopy</span> <span class="pl-c1">=</span> <span class="pl-c1">JSON</span><span class="pl-kos">.</span><span class="pl-en">parse</span><span class="pl-kos">(</span><span class="pl-c1">JSON</span><span class="pl-kos">.</span><span class="pl-en">stringify</span><span class="pl-kos">(</span><span class="pl-s1">collection</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// Only change code below this line</span>
<span class="pl-k">function</span> <span class="pl-en">updateRecords</span><span class="pl-kos">(</span><span class="pl-s1">id</span><span class="pl-kos">,</span> <span class="pl-s1">prop</span><span class="pl-kos">,</span> <span class="pl-s1">value</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

<span class="pl-k">if</span><span class="pl-kos">(</span><span class="pl-s1">value</span> <span class="pl-c1">!==</span> <span class="pl-s">""</span><span class="pl-c1">&amp;&amp;</span><span class="pl-s1">prop</span><span class="pl-c1">!=</span><span class="pl-s">"tracks"</span><span class="pl-kos">)</span>
    <span class="pl-kos">{</span>
      <span class="pl-s1">collection</span><span class="pl-kos">[</span><span class="pl-s1">id</span><span class="pl-kos">]</span><span class="pl-kos">[</span><span class="pl-s1">prop</span><span class="pl-kos">]</span><span class="pl-c1">=</span><span class="pl-s1">value</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>


<span class="pl-k">return</span> <span class="pl-s1">collection</span><span class="pl-kos">;</span>

   <span class="pl-kos">}</span>

<span class="pl-c">// Alter values below to test your code</span>
<span class="pl-en">updateRecords</span><span class="pl-kos">(</span><span class="pl-c1">5439</span><span class="pl-kos">,</span> <span class="pl-s">"artist"</span><span class="pl-kos">,</span> <span class="pl-s">"ABBA"</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Challenge <a href="https://www.freecodecamp.com/challenges/record-collection#?solution=%0A%2F%2F%20Setup%0Avar%20collection%20%3D%20%7B%0A%20%20%20%20%222548%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%22Slippery%20When%20Wet%22%2C%0A%20%20%20%20%20%20%22artist%22%3A%20%22Bon%20Jovi%22%2C%0A%20%20%20%20%20%20tracks%3A%20%5B%20%0A%20%20%20%20%20%20%20%20%22Let%20It%20Rock%22%2C%20%0A%20%20%20%20%20%20%20%20%22You%20Give%20Love%20a%20Bad%20Name%22%20%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%222468%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%221999%22%2C%0A%20%20%20%20%20%20%22artist%22%3A%20%22Prince%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%0A%20%20%20%20%20%20%20%20%221999%22%2C%20%0A%20%20%20%20%20%20%20%20%22Little%20Red%20Corvette%22%20%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%221245%22%3A%20%7B%0A%20%20%20%20%20%20%22artist%22%3A%20%22Robert%20Palmer%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%225439%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%22ABBA%20Gold%22%0A%20%20%20%20%7D%0A%7D%3B%0A%2F%2F%20Keep%20a%20copy%20of%20the%20collection%20for%20tests%0Avar%20collectionCopy%20%3D%20JSON.parse%28stringify%28collection%29%29%3B%0A%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0Afunction%20updateRecords%28id%2C%20prop%2C%20value%29%20%7B%0A%20%20%0A%20%20%20%20if%20%28value%20%3D%3D%3D%20%22%22%29%20%7B%0A%20%20%20%20%20%20delete%20collection%5Bid%5D%5Bprop%5D%3B%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20if%20%28prop%20%3D%3D%3D%20%22tracks%22%29%20%7B%0A%20%20%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D.push%28value%29%3B%20%20%0A%20%20%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D%20%3D%20value%3B%0A%20%20%20%20%20%20%7D%20%20%20%20%20%20%0A%20%20%20%20%7D%0A%20%20%0A%20%20return%20collection%3B%0A%7D%0A%0A%2F%2F%20Alter%20values%20below%20to%20test%20your%20code%0AupdateRecords%285439%2C%20%22artist%22%2C%20%22ABBA%22%29%3B%0A%0A" rel="nofollow">Record Collection</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36</code>.<br>
Please describe how to reproduce this issue, and include links to screenshots if possible.</p>
<p dir="auto">My code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
// Setup
var collection = {
    &quot;2548&quot;: {
      &quot;album&quot;: &quot;Slippery When Wet&quot;,
      &quot;artist&quot;: &quot;Bon Jovi&quot;,
      tracks: [ 
        &quot;Let It Rock&quot;, 
        &quot;You Give Love a Bad Name&quot; 
      ]
    },
    &quot;2468&quot;: {
      &quot;album&quot;: &quot;1999&quot;,
      &quot;artist&quot;: &quot;Prince&quot;,
      &quot;tracks&quot;: [ 
        &quot;1999&quot;, 
        &quot;Little Red Corvette&quot; 
      ]
    },
    &quot;1245&quot;: {
      &quot;artist&quot;: &quot;Robert Palmer&quot;,
      &quot;tracks&quot;: [ ]
    },
    &quot;5439&quot;: {
      &quot;album&quot;: &quot;ABBA Gold&quot;
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {


  return collection;
}

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

"><pre class="notranslate"><span class="pl-c">// Setup</span>
<span class="pl-k">var</span> <span class="pl-s1">collection</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-s">"2548"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"album"</span>: <span class="pl-s">"Slippery When Wet"</span><span class="pl-kos">,</span>
      <span class="pl-s">"artist"</span>: <span class="pl-s">"Bon Jovi"</span><span class="pl-kos">,</span>
      <span class="pl-c1">tracks</span>: <span class="pl-kos">[</span> 
        <span class="pl-s">"Let It Rock"</span><span class="pl-kos">,</span> 
        <span class="pl-s">"You Give Love a Bad Name"</span> 
      <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"2468"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"album"</span>: <span class="pl-s">"1999"</span><span class="pl-kos">,</span>
      <span class="pl-s">"artist"</span>: <span class="pl-s">"Prince"</span><span class="pl-kos">,</span>
      <span class="pl-s">"tracks"</span>: <span class="pl-kos">[</span> 
        <span class="pl-s">"1999"</span><span class="pl-kos">,</span> 
        <span class="pl-s">"Little Red Corvette"</span> 
      <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"1245"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"artist"</span>: <span class="pl-s">"Robert Palmer"</span><span class="pl-kos">,</span>
      <span class="pl-s">"tracks"</span>: <span class="pl-kos">[</span> <span class="pl-kos">]</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-s">"5439"</span>: <span class="pl-kos">{</span>
      <span class="pl-s">"album"</span>: <span class="pl-s">"ABBA Gold"</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-c">// Keep a copy of the collection for tests</span>
<span class="pl-k">var</span> <span class="pl-s1">collectionCopy</span> <span class="pl-c1">=</span> <span class="pl-c1">JSON</span><span class="pl-kos">.</span><span class="pl-en">parse</span><span class="pl-kos">(</span><span class="pl-en">stringify</span><span class="pl-kos">(</span><span class="pl-s1">collection</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-c">// Only change code below this line</span>
<span class="pl-k">function</span> <span class="pl-en">updateRecords</span><span class="pl-kos">(</span><span class="pl-s1">id</span><span class="pl-kos">,</span> <span class="pl-s1">prop</span><span class="pl-kos">,</span> <span class="pl-s1">value</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>


  <span class="pl-k">return</span> <span class="pl-s1">collection</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-c">// Alter values below to test your code</span>
<span class="pl-en">updateRecords</span><span class="pl-kos">(</span><span class="pl-c1">5439</span><span class="pl-kos">,</span> <span class="pl-s">"artist"</span><span class="pl-kos">,</span> <span class="pl-s">"ABBA"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
</pre></div>