You can do it with pythagoras theorem
If you have two points (x1, y1) and (x2, y2)
then you can calculate the difference in x and difference in y, lets call them a and b.
var a = x1 - x2;
var b = y1 - y2;
var c = Math.sqrt( a*a + b*b );
// c is the distance
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…