JSFiddle - React, Tailwind, and code Playground

HTML

<div id="printer"></div>

JavaScript

var strings = [
                'Steve jobs created the iPod when he was at Apple',
                'I really like the new Macbook by Apple',
                'Jony Ive was concerned being fired by Steve Jobs after his return to Apple',
                'The new Macbook has just one USB-C type connector',
                'I like bananas',
                'The brezels I can buy in my local store are much better than the ones in the supermarket',
                'the',
                'foo',
                'Steve'
            ];
            
            String.prototype.LevenshteinDistance = function (s2) {
                var array = new Array(this.length + 1);
                for (var i = 0; i < this.length + 1; i++)
                    array[i] = new Array(s2.length + 1);

                for (var i = 0; i < this.length + 1; i++)
                    array[i][0] = i;
                for (var j = 0; j < s2.length + 1; j++)
                    array[0][j] = j;

                for (var i = 1; i < this.length + 1; i++) {
                    for (var j = 1; j < s2.length + 1; j++) {
                        if (this[i - 1] == s2[j - 1]) array[i][j] = array[i - 1][j - 1];
                        else {
                            array[i][j] = Math.min(array[i][j - 1] + 1, array[i - 1][j] + 1);
                            array[i][j] = Math.min(array[i][j], array[i - 1][j - 1] + 1);
                        }
                    }
                }
                return array[this.length][s2.length];
            };
            
            function print (msg) {
                $p = $('#printer');
                $p.html($p.html() + '<br>' + msg);
            }
            
            function similarity(s1, s2) {
                var longer = s1;
                var shorter = s2;
                if (s1.length < s2.length) {
                    longer = s2;
                    shorter = s1;
                }
                var longerLength = longer.length;
            ...