so, to try to sum up something from all this…
- the evaluation function is wrong or incomplete
- the first listed solution, Solution 1, is wrong (from Hints section)
the second solution, ‘Solution 2’, works, tho.
the strict/variable stuff seems like a big topic.
but i figured out why the ReferenceError
only shows up sometimes – when I put my own updateRecords()
function call at the bottom of the editor, it forced the virtual/Editor/strict-checker stream of execution (presumably?) to go through the non-strict-code – which then triggered the ReferenceError
.
so, not sure if that is possible – have the ‘strict check’ just check every possible path through the code – like 100% test coverage.
Original bottom of code:
updateRecords(collection, 5439, 'artist', 'ABBA');
Bottom of code in my sample code:
updateRecords(collection, 5439, "tracks", "Take a Chance on Me");
console.log(collection[5439]);