Is it possible to merge two strings in JavaScript so that all the similarities are kept only keeping the differences.
For example
var string1 = "I am a sentence";
var string2 = "I am a dancer";
var string3 = function(string1, string2);
string3 = "I am a sentence dancer";
The similarities between the were preserved but the differences are added onto the string.
The reason I am asking is that I have a website application where the user can either edit the page through contenteditable
or the code itself through a <textarea></textarea>
. And so if they edit both, it submits both changes.