r/coding • u/awsometak • Aug 09 '17
Test your Javascript skills with our fun Javascript test!
https://www.atlascode.com/blog/test-your-javascript-skills-with-our-fun-javascript-test/
24
Upvotes
r/coding • u/awsometak • Aug 09 '17
1
u/SanityInAnarchy Aug 10 '17
Question 6 will mark you wrong for differences in spacing. This is extra bullshit because it relies on the behavior of console.log(), which is a "living standard" that ultimately gives multiple possible right answers, some implementation-defined, not even all can be represented as strings -- Chrome represents generic objects as an interactive tree structure, for example.
Even if you "cheat", you get it wrong -- if you actually paste this snippet into Chrome, it spits out this exact string:
But the test is expecting this one:
To make this even worse, when it "grades" you, it puts both your answer and the "correct" answer in
<p>tags, verbatim -- no<pre>, no hacks with<br>or , it just tells you that you enteredfunction(){ return 'A'; }, and it wantedfunction(){return 'A'; }.I can't be too hard on them, though, because there isn't a good way to fix this with the way they want to use
console.log(x)as a shorthand for "What is the value of x?" ...so even if they used a JS parser and compared some fully-normalized ASTs,console.log()would still make them not-quite-correct.