Here's a function that takes two strings as arguments and returns an array of differences between them:
index.tsx199 chars10 lines
This function uses a loop to iterate through each character in the strings. It compares each character at the same position in both strings and adds a tuple of the differing characters to an output array if they are not the same.
Testing this function with two strings "hello" and "hella" would return an array with one item: [["o", "a"]]. This indicates that the only difference between the two strings is that the "o" in "hello" is replaced by an "a" in "hella".
gistlibby LogSnag