js-test-7

Let's find out what’s the deal with JavaScript arrays. Is `array` an array? (think well, then click for the answer and explanation)

In line one we create an array and bind it with the array constant. Then the type of the value of this constant is evaluated by the typeof operator.

There’s no such type as array in JS, so it’s impossible to see the message ARRAY! on the screen. In fact, all JS arrays are objects, so the execution goes into the else branch, and SOMETHING WEIRD is printed on the screen.


ANSWER: SOMETHING WEIRD will be logged to the screen as all JS arrays have the type object.