Compare two strings using javascript (nodejs) get uncommon characters count

Hafiz Hussain
2 min readJun 1, 2022

Sample input

string1 = “Joe”

string2 = “John”

Expected output is 3

Explanation of the output

From string1 = 1 letter, “e” is uncommon and from string2 = 2 letters “ h and n” are uncommon characters with the other string.

The solution looks obvious, but I didn’t find any straight forward method on internet to do so. I found some solution on geeksforgeeks website, but it was for…

--

--