Zählen Sie No of Word in JavaScript String

return str.split(' ').length;
Glamorous Gharial