Deviopath › JavaScript

Count Unique Words

Medium · Strings

Write a function countUniqueWords that returns how many different words are in a sentence.

Words are separated by spaces (there may be several in a row). Compare words case-insensitively and ignore the punctuation marks ., ,, ! and ?.

Next: Group By Property