nodejs check if if array is empty code example
Example 1: javascript not empty array not string
if (Array.isArray(array) && array.length) {
// array exists and is not empty
}
Example 2: check if array is empty javascript
array.length = []
if (Array.isArray(array) && array.length) {
// array exists and is not empty
}
array.length = []