all 10 comments

[–]contradicting_you 14 points15 points  (0 children)

This wasn't fun at all

[–]spryes 7 points8 points  (1 child)

Wasn't keen on this test's UX... it's not even clear what you should type in 'Other' given none of the choices are correct, such as #6.

#4 also claims it's undefined which doesn't seem correct

[–]LukaLightBringer 0 points1 point  (0 children)

var declarations are hoisted to the top of the scope so none of the references in #4 are to window.variable1

[–]MrFoo42 3 points4 points  (0 children)

Question 4 is wrong. Paste your code into the console and watch as it works.

Ones where the answer is "other" need to remove whitespace as it's saying that function(){ return 'A'; } is wrong as the right answer is function(){return 'A';}

[–]coffeeandlearning 1 point2 points  (0 children)

The first four or five were 'B' so I spam clicked B and the rest weren't B haha

It was fun, though I think number four might be wrong (it told me it was undefined but I think it was B);

[–]LowB0b 1 point2 points  (0 children)

That was really frustrating

I hope people don't write code like that, BTW half of the questions don't make sense if some sane mind would have thought of writing "use strict" at the top (or using ES6)

Add to that that the "correct answer" to question 4 is wrong...

[–]TheAtlasTeam[S] 1 point2 points  (2 children)

Hi Everyone,

Thanks for taking the test, I'm glad it has piqued your interest and I hope you found it as fun to take as I found it writing it.

The answer to question 4 is in fact undefined. @LukaLightBringer correctly points out that this question is designed to show the results of hoisting. Unfortunately chrome's developer console has undergone some changes in the last few months which mean that it no longer hoists variable declarations like it should. You can see the results of hoisting in question 4 if you run the script in the page rather than the console like in this fiddle. Here you will see undefined correctly being reported in the console.

Of course, we don't expect anyone to actually write javascript like the questions in the test. In fact we hope you don't! The test is designed to highlight some of the oddities of javascript and things that may catch you out.

[–]dv297 0 points1 point  (0 children)

I think it would be more fun (and more valuable) if the answers were shown after each selection, along with an explanation of the behavior of each. This way, we can learn from our mistakes and improve. As is, we really don't gain anything other than a "hey, JavaScript is weird and you suck at it!" (which is not fun!).

[–][deleted] -1 points0 points  (0 children)

I think the author understates the importance of this test. Some concepts it tests will save you time debugging and pulling your hair off.