Check if a value is an array using Object.prototype.toString. More reliable than instanceof Array for cross-frame scenarios.
The value to check
Returns true if value is an array, false otherwise
import isArray from '~/utils/isArray';isArray([1, 2, 3]); // trueisArray('hello'); // falseisArray({0: 'a', 1: 'b', length: 2}); // false (array-like object) Copy
import isArray from '~/utils/isArray';isArray([1, 2, 3]); // trueisArray('hello'); // falseisArray({0: 'a', 1: 'b', length: 2}); // false (array-like object)
Check if a value is an array using Object.prototype.toString. More reliable than instanceof Array for cross-frame scenarios.