perché il numero di parole è dispari... arrotonda
codice:
<script language="JScript" runat="server">
function contaParole(frase) {
return Math.round((frase.split(/\b/).length)/2);
}
</script>
<%
frase = "oggi ho sonno"

response.write "La frase:
" & frase & "
contiene " & contaParole(frase) & " parole."
%>