In TypeScript or JavaScript, checking if a variable is an array can be completed in two ways.
Using the Array.isArray()
Using the native Array.isArray()
method, a boolean will be returned.
|
|
Using the instanceOf
operator
As an alternative option, instanceOf
will yield the same results.
|
|