I see your core of the logic and raise you my clusterfuck of the logic:
[d,e]=document.body.innerText.split`
`.map(l=>l.split`,`.map(x=>[x[0],parseInt(x.substr(1))]))
manhattan = (x,y) => Math.abs(x)+Math.abs(y)
ps=[]
x=0;y=0;cx=9999999;cy=999999;s=1
d.map(([dir,r])=>{switch (dir) {
case 'R': for (i=0;i<r;i++) {
ps[[x,y]]=s++;
x++} break;
case 'L': for (i=0;i<r;i++) {
ps[[x,y]]=s++;
x--} break;
case 'U': for (i=0;i<r;i++) {
ps[[x,y]]=s++;
y++} break;
case 'D': for (i=0;i<r;i++) {
ps[[x,y]]=s++;
y--} break;
}})
x=0;y=0;s=1;steps=9999999999
e.map(([dir,r])=>{switch (dir) {
case 'R': for (i=0;i<r;i++,s++) {if (ps[[x,y]] && s+ps[[x,y]]<steps && !(x==0 && y==0)) {steps=s+ps[[x,y]]};
x++} break;
case 'L': for (i=0;i<r;i++,s++) {if (ps[[x,y]] && s+ps[[x,y]]<steps && !(x==0 && y==0)) {steps=s+ps[[x,y]]};
x--} break;
case 'U': for (i=0;i<r;i++,s++) {if (ps[[x,y]] && s+ps[[x,y]]<steps && !(x==0 && y==0)) {steps=s+ps[[x,y]]};
y++} break;
case 'D': for (i=0;i<r;i++,s++) {if (ps[[x,y]] && s+ps[[x,y]]<steps && !(x==0 && y==0)) {steps=s+ps[[x,y]]};
y--} break;
}})
steps
//also it's off by two but that's solved by hand
No hating unless you ranked higher than me :^)