I have an array like:
["", "", "", "1", "", ""]
I want to alert when all the array values are blanks
, i.e, when the array is like this:
["", "", "", "", "", ""]
How can I achieve this.
Try this,
["", "", "", "", "", ""].join("").length==0
If you want to remove spaces,
["", "", "", "", "", ""].join("").replace(/\s/gi,'').length==0
Note :
This will not work for inputs like ["", [], "", null, undefined, ""]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With