so this is a bit trippy.
tldr; i think my original answer should have been marked correct, and the reason i didn’t see the ReferenceError wrt the
newTrackArray error is because it is not actually an error - it’s a global variable - and the error did not show up for me originally because I had also modified the line(s) at the bottom of the editor (which is prob not generally advisable), thus seemingly/potentially confusing the evaluation function.
i was/am pretty sure i didn’t see that error before – until i just checked again by copy/pasting my own code from here back into the editor, like @ilenia suggested.
so in going back to try to figure out why i might not have seen it before, i was able to replicate (probably?) what was happening before.
first, i think my solution was generally ‘correct’ in that it should have satisfied the requirements of the exercise. that is, if you inspected the object at the end, it would have been exactly what it should have been.
second, i think it’s good that the evaluation mechanism at least highlights, in background-red, potential variable problems (as it does sometimes in my testing), and in other times actually explicitly points out and logs a ‘ReferenceError’ - as pointed out by @ilenia.
and the key to my changing results are the
console.log() statements i added/changed at the bottom of the editor (my bad!).
so, what i saw initially is shown in the screenshot below:
newTrackArray is not declared with
console.log() – seen in green.
- only one test fails
- there is no ReferenceError shown (due to
newTrackArray is not highlighted in red in this specific scenario, but it is in others – depending on whether I have modified/added/removed any other functions to the bottom of the editor (this is a cool feature)
so that kind of gets to why i originally asked how answers are evaluated.
i do think there is something small here to improve, if it’s possible to articulate it.
- i think my original solution should be evaluated to ‘correct’ – all tests should pass
- we can maybe be explicit about requiring the use of only local variables
- maybe we can avert any ‘weirdness’ like i introduced by just adding a simple
//do not change anything below this line as appears in other exercises
just some ideas.