JSFiddle - React, Tailwind, and code Playground

by DeadByElpy

HTML

<h1>Find unique lines</h1>
<textarea name="" id="text1" cols="30" rows="10"></textarea>
<textarea name="" id="text2" cols="30" rows="10"></textarea>
<button id="combine">Combine</button>
<textarea name="" id="rr" cols="30" rows="10"></textarea>

JavaScript

Array.prototype.diff = function(a) {
    return this.filter(function(i) {return a.indexOf(i) < 0;});
};

$(document).ready(function() {
    $('#combine').click(function() {
        var text1 = $('#text1').val().split("\n");
        var text2 = $('#text2').val().split("\n");
        text1.sort();
        text2.sort();
        var rr = text1.diff(text2);
        $('#rr').val(rr.join("\n"));
});

});