53
Detecting an Array
2021-04-08 - JavaScript
1// JS Tip of the Day
2// Detecting an Array
3
4console.log(Array.isArray([])); // true
5console.log(Array.isArray(['Batman', 'Superman'])); // true
6console.log(Array.isArray({ 0: 'Batman', 1: 'Superman', length: 2})); // false with array-like objects
#JStipoftheday