Javascript to count sentences