This is especially true if you have business logic that differentiates between an array and a normal value, and performs different instructions based on the type.
Well it’s actually super easy to do that. Always use the
isArray() static method provided by the runtime on the Array object, introduced in ECMAScript: 5
Here is the way you would check.
const list = ['a', 'b', 'c', 'd'] Array.isArray(list) //true