Array.prototype.find = function(term) { let r=
this.map(r=>r.includes(term)).indexOf(!0), c=this[r].indexOf(term); return {x:r,y:c};};
Array.prototype.draw = function(x,y,$=this[x][y]) { this[x] = this[x].substring(0,y) + ($===' '?'*':$) + this[x].substring(y+1);};
class Line { constructor (s, e, Δx = e.x-s.x,Δy = e.y-s.y) { this.xi = Δx > 0 ? 1 : Δx < 0 ? -1 : 0; this.yi = Δy > 0 ? 1 : Δy < 0 ? -1 : 0; this.s = s; this.e = e;}};
let connectTheDots = p => {
let lc = p.match(/[^ \n]/g).length - 1;
p = p.split`\n`;
for (let l = 0; l < lc; l++) {
let char = String.fromCharCode(97 + l), next = String.fromCharCode(98 + l), L = new Line(p.find(char), p.find(next));
while (L.s.x !== L.e.x || L.s.y !== L.e.y) p.draw(L.s.x,L.s.y), L.s.x += L.xi, L.s.y += L.yi;
} return p.join`\n`.replace(/\w/g,'*');
};