Check if array is empty

PHOTO EMBED

Wed Jan 05 2022 11:32:02 GMT+0000 (Coordinated Universal Time)

Saved by @desiboli ##javascript ##js

const isNotEmpty = arr => Array.isArray(arr) && arr.length > 0;
isNotEmpty([1, 2, 3]);
// Result: true
content_copyCOPY

https://blog.devgenius.io/15-javascript-codes-you-will-always-need-e8569903dd1