DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

Cover image for Check if an array is empty
syedsimanta03
syedsimanta03

Posted on

Check if an array is empty

const isEmpty = arr => !Array.isArray(arr) || arr.length === 0;

// Examples
isEmpty([]); // true
isEmpty([1, 2, 3]); // false

Top comments (0)

Classic DEV Post ๐Ÿ‘‡

Visualizing Promises and Async/Await ๐Ÿคฏ

async await