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)