Summing intertwined terms of an array I'm recieving 2-dimensional positions of two objects as a string with this format: x1,y1,x2,y2. The string is recieved from a readline call (replaced in the snippet with a prompt).

In order to get the horizontal and vertical position differentials, I'm writing the following code:



[x1,y1,x2,y2]=prompt("Please enter the positions separated by commas").split`,`
dx=+x2-x1
dy=+y2-y1
console.log(dx,dy)




Is there a way to get dx and dy using less characters since I don't really need the positions? I suppose the main problem could be in the variable assignment which can probably be done in one step. I can use ECMAScript 6.

I don't really know if I have to precise it but removing the text in the prompt or giving variables 1-char names doesn't count, I have written them on purpose to clarify my question. The console.log is not part of the code golf either since the variables are supposed to be used after in the program.
I'm not sure exactly what you're looking for, but perhaps something like this?

[x1,y1,dx,dy]=prompt("Please enter the positions separated by commas").split`,`
dx-=x1
dy-=y1
console.log(dx,dy)


Reusing x2 and y2 as dx and dy, respectively, lets you use the -= operator to shorten it a bit.