The code above defines a function called findTheDifference which takes two strings as input and performs a simple comparison between the values in the two input arrays. If the strings don't match, the function returns the characters in the tSplit array that aren't matched by the sSplit array.
const findTheDifference = (s, t) => {
// split the two incoming strings and sort them
let sSplit = s.split('').sort()
let tSplit = t.split('').sort()
// create loop to iterate through input strings
for( let i = 0; i < tSplit.length; i++){
// compare values array values
if( sSplit[i] !== tSplit[i]){
//return non matching chars
return tSplit[i];
}
}
};