I am working with ES6 Proxy. I have created a proxy of an array, now when i check the type of proxy it is giving me as Object
type.
Question:
How can i check if the proxy i have created was for array or object?
Example:
const arr = ['a', 'b', 'c'];
const arrProxy = new Proxy(arr, {});
alert(typeof(arrProxy));
UPDATE (SOLUTION):
Instead of using typeof
, we should use Array.isArray
const arr = ['a', 'b', 'c'];
const arrProxy = new Proxy(arr, {});
alert(Array.isArray(arrProxy));