How can I determine if an input string only contains spaces, using javascript?
Alternatively, you can do a test() which returns a boolean instead of an array
//assuming input is the string to test if(/^\s*$/.test(input)){ //has spaces }