Checking is a value is an array is straight forward in JavaScript:
Array.isArray(value);
However, I need to distinguish between a value that is an array and a value that is andarray and also an array prototype. For instance:
Array.isArray([]); // true
Array.isArray(Object.getPrototypeOf([])); // true, but need false
Unfortunately the prototype of arrays is also type array, which is why Array.isArray
returns true in this example.
If anyone knows how I can differentiate between the two (test for arrays, but not array prototypes) it would be greatly appreciated.
console.log([] instanceof Array) // true
console.log(Object.getPrototypeOf([]) instanceof Array) // false