Is there any way to efficiently check if the variable is Object or Array, in NodeJS & V8? I’m writing a Model for MongoDB and NodeJS, and to traverse the object tree I need to know if the object is simple (Number, String, …) or composite (Hash, Array). It seems that V8 has fast built-in Array.isArray, but how to check
Advertisement
Tag: typeof
When iterating over values, why does typeof(value) return “string” when value is a number? JavaScript
I’m using Google Chrome for this test: Contrary to intuition, the first loop alerts “string” three times, while the second loop alerts “number” three times. numarray = [1, 2, 3]; /…
Advertisement