🔥 NEW! Get my book The Developer's Guide to Having a Successful Blog
In this book I teach you all I know about starting and growing a blog.
Launch promo: 25% OFF until tomorrow! And a special challenge for you!
Sometimes you got passed an object in a function, and you need to check if this is an array.
Maybe if it’s an array you perform some operation, and if it’s not an array you perform something else.
How can you determine if an object is an array?
isArray() static method provided by the
Array built-in object, introduced in ECMAScript 5:
const list = [1, 2, 3] Array.isArray(list) //true