Check out example codes for "count how many characters in the same position are eqial in both strings". It will help you in understanding the concepts better.
Code Example 1
sum(c1 == c2 for c1, c2 in zip(string1, string2))
Code Example 2
sum(1 if c1 == c2 else 0 for c1, c2 in zip(string1, string2))
Learn ReactJs, React Native from akashmittal.com