<!DOCTYPE html>
<html leng = 'en'>
<head>
<meta charset = 'UTF-8'/>
</head>
<body>
<script>
var x1 = parseInt(prompt('请输入点1的x坐标值'));
var y1 = parseInt(prompt('请输入点1的y坐标值'));
var x2 = parseInt(prompt('请输入点2的x坐标值'));
var y2 = parseInt(prompt('请输入点2的y坐标值'));
console.log(Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2)));
</script>
</body>
</html>
js write the distance between two points
Guess you like
Origin blog.csdn.net/weixin_48727085/article/details/107725553
Recommended
Ranking