After attempting multiple JavaScript quizzes I thought it would be fun to have a go creating one for my readers. It doesn’t involve any DOM nonsense or browser quirks — this is just plain ECMAScript (3rd edition). It tests your knowledge of the language and specification.

Within each textbox enter what you think the piece of code above it returns.

  • The pieces of code are executed as statements.
  • Enter your answer as if you were typing the code literally. So, if the answer is the string "foo", then type "foo" (including the quotes — double or single), and if it’s an array like [1,2,3] then type it out just like that.
  • If you think an error is thrown then enter ERROR in the appropriate textbox.
  • When there are multiple statements, type what the last statement returns.

Please access this post directly in order to take the quiz (note: JavaScript must be enabled).

Like I said, it doesn’t test your everyday knowledge of JS, but your comprehension of the specification. Feel free to post results and discuss the quiz!

I’ll eventually post a comment with all the answers (plus explanations), assuming nobody beats me to it.