To check if a variable is an array in JavaScript, we use the Array.isArray method.
For instance, we write
const isArray = Array.isArray(value);
to call Array.isArray with value to check if value is an array.
If it is, then true is returned.