Comment on You Can't JavaScript Under PressureparentComments−dclowd990112yTIL there is no typeof === 'array'. -_-−rhengles12y [] instanceof Array; // returns true−bentruyman12yHowever this fails on "Array-like" objects like NodeLists.−dclowd990112yClever...−ep10312yArray.isArray(yourVariable), yeah, had to mdn that one too.−hayksaakian12ytypeof(["an array", "contains multiple things"]) == typeof(["sometimes"])−iclelland12yYes, but: typeof(["an array", "contains multiple things"]) == typeof({but_this_one: "is an object"})
Comments
TIL there is no typeof === 'array'. -_-
However this fails on "Array-like" objects like NodeLists.
Clever...
Array.isArray(yourVariable), yeah, had to mdn that one too.
typeof(["an array", "contains multiple things"]) == typeof(["sometimes"])
Yes, but: