This function checks whether an array is empty.
JavaScript:
let isEmpty = arr => arr.length === 0;
// Example
console.log(isEmpty([])); // true
console.log(isEmpty(['Hello', 'world'])); // false
TypeScript:
let isEmpty = (arr: T[]): boolean => arr.length === 0;
// Example
console.log(isEmpty([])); // true
console.log(isEmpty(['Hello', 'world'])); // false