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