4 ms·
TIL there is no typeof === 'array'. -_-
by dclowd9901 13y ago
TIL there is no typeof === 'array'. -_-
- ep103 13y agoArray.isArray(yourVariable), yeah, had to mdn that one too.
- rhengles 13y ago[] instanceof Array; // returns true
- dclowd9901 13y agoClever...
- bentruyman 13y agoHowever this fails on "Array-like" objects like NodeLists.
- hayksaakian 13y agotypeof(["an array", "contains multiple things"]) == typeof(["sometimes"])
- iclelland 13y agoYes, but: typeof(["an array", "contains multiple things"]) == typeof({but_this_one: "is an object"})