+ 6
Write a function isEmpty(arr) that returns true if the array is empty, and false if is not empty or is undefined.Need help...
function isEmpty(arr) { return true } Here is what i tried(how can i do multiple return): function isEmpty(arr) { arr = [[], [0, 1], ['a', 'b'], [undefined]] for (var i = 0; i < arr.length; i++) { var elem = arr[i] if (elem == arr[0]) { return true } } }
1 Respuesta
+ 1
You could store the returns in an array/list and return the array/list itself.
let return = [true , false , false , true];