How to check the given variable is an Array in JavaScript?

1. Method -1: Using the Array.isArray method Array.isArray(<variable name>)

2. Method -2: Using the instanceof operator The instanceof operator is used to test whether the prototype property of a constructor appears anywhere in the prototype chain of an object. <variable> instanceof Array

3. Method -3: Checking the constructor property of the variable <variable>.constructor === Array