Trim the string and then check for space
var hasMultipleWords = input.trim().indexOf( " " ) != -1; //returns true if there is a space
1
solved To know if a string is composed of a word or two words [duplicate]
Trim the string and then check for space
var hasMultipleWords = input.trim().indexOf( " " ) != -1; //returns true if there is a space
1
solved To know if a string is composed of a word or two words [duplicate]