JSFiddle - React, Tailwind, and code Playground

by Alexis LĂłpez Espinoza

HTML

<textarea id="textarea"></textarea>

CSS

#textarea{
	height: 100px;
}

JavaScript

var a = "hola mundo bye world",
    b = "hola amigos bye buddy",
    ax = a.split(" "),
    bx = b.split(" "),
    c = [];
    
ax.forEach(function(w){
    if (b.indexOf(w) < 0){
        c.push(w);
    }
});

c.push("\n\n\n\r");
 
bx.forEach(function(w){
    if (a.indexOf(w) < 0){
        c.push(w);
    }
});
 
textarea.value = c.join(" "); //mundo world ||| amigos buddy