In the following code snippet an interviewer would test your knowledge about the
Code snippet as a picture
What’s going to be the output? 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
arrayconstant. Then the type of the value of this constant is evaluated by the
There’s no such type as
arrayin 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
SOMETHING WEIRDis printed on the screen.
SOMETHING WEIRDwill be logged to the screen as all JS arrays have the type