Check if an array is empty

JavaScript version
// `arr` is an array
const isEmpty = (arr) => Array.isArray(arr) && !arr.length;
TypeScript version
const isEmpty = <T,_>(arr: T[]): boolean => Array.isArray(arr) && !arr.length;
Examples
isEmpty([]); // true
isEmpty([1, 2, 3]); // false