AI智能
改变未来

js写两点之距

<!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>
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » js写两点之距