4 ms·
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 obviou
by hcarvalhoalves 13y ago
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").
- hayksaakian 13y agotypeof(x) === typeof(["something which is certainly", "an array"]) or am i missing something?
- wging 13y ago> 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.
- Bahamut 13y agox instanceof Array