Comment on You Can't JavaScript Under PressureComments−hcarvalhoalves12yLast one reminded me how awful JS is once again. There are 5 different ways to check if an object is an array, some are implementation dependent, and the obvious one doesn't work (typeof x == "array").−hayksaakian12ytypeof(x) === typeof(["something which is certainly", "an array"])or am i missing something?−wging12y > typeof ["a", "b"] "object" Of course, since you're told you'll only get numbers, arrays, and strings, that is enough to solve the problem narrowly.−Bahamut12yx instanceof Array
Comments
Last one reminded me how awful JS is once again. There are 5 different ways to check if an object is an array, some are implementation dependent, and the obvious one doesn't work (typeof x == "array").
typeof(x) === typeof(["something which is certainly", "an array"])
or am i missing something?
x instanceof Array