JSFiddle - React, Tailwind, and code Playground

HTML

<pre id="tests"></pre>

CSS

.result {
    font-family: Courier New, monospace;
    font-size: 11px;
    margin-bottom: 5px;
}

JavaScript

var test0 = ['a','b','c','d','e','f'];
var test1 = ['a','b','x','y','c','d','e','f'];
var test2 = ['b','c','f'];
var test3 = ['a','d','x','y','e','f','g'];
var test4 = ['a','b','c','k','e','f'];
var test5 = ['a','b','d','c','e','f'];
var test6 = ['a','b','d','w','x','y','z'];
var test7 = ['a','b','d','y','z'];
var test8 = ['a','b','d','x','y','z'];
var test9 = ['a','b','c','d'];
var test10 = ['a','b','c','d','e','f','g','h'];

function t(a, b) {
    $('<div class="result"/>').append(
        $('<div/>').text('A:    ' + JSON.stringify(a)),
        $('<div/>').text('B:    ' + JSON.stringify(b)),
        $('<div/>').text('Diff: ' + JSON.stringify(arrayDiff(a, b)))
    ).appendTo('#tests');
}

t(test0, test1);
t(test0, test2);
t(test0, test3);
t(test0, test4);
t(test0, test5);
t(test0, test6);
t(test0, test7);
t(test0, test8);
t(test0, test9);
t(test0, test10);

function isSame(oldval, newval) {
    // this would be replaced with a more advanced comparison at a later date
	return oldval === newval;
}

function arrayDiff(oldarr, newarr) {
	var a0 = 0, b0 = 0, a1 = null, b1 = null;

	var diff = [];

	while(true) {

		if(a1 === null) { // b1 will also be null
			var aEof = a0 >= oldarr.length;
			var bEof = b0 >= newarr.length;
			if(aEof && bEof)
				return diff;
			if(aEof) {
				diff.push([b0, '+'].concat(newarr.slice(b0)));
				return diff;
			}
			if(bEof) {
				diff.push([a0, '-', oldarr.length - a0]);
				return diff;
			}
			if(isSame(oldarr[a0], newarr[b0])) {
				a0++;
				b0++;
				continue;
			}
			a1 = a0 + 1;
			b1 = b0 + 1;
		}

		var a1Eof = a1 >= oldarr.length;
		var b1Eof = b1 >= newarr.length;
		if(a1Eof || b1Eof) {
			diff.push([a0, '-', oldarr.length - a0]);
			diff.push([b0, '+'].concat(newarr.slice(b0)));
			return diff;
		}

		if(isSame(oldarr[a1], newarr[b0])) {
			diff.push([a0, '-', a1 - a0]);
			a0 = a1 + 1;
			b0++;
			a1 = null;
			b1 = null;
			continue;
		}
		else if(isSame(oldarr[a0], newarr[b1])) {
			diff.push([a0,...