JSFiddle - React, Tailwind, and code Playground

by Patel1327

HTML

<button onclick="getXandY()">
 Get XY</button>

JavaScript

var x1 = 0;
var x2 = 0;
var y1 = 0
var y2 = 0;

function getXandY() {
  x1 = prompt(" allow me a x value for the first corrdinate");
  x2 = prompt(" allow me a y value for the first corridnate");
  y1 = prompt("allow me a x value for the second corridnate");
  y2 = prompt("allow me a y value for the second corridnate");
  document.getElementById("corridnate").innerText = " The first corridnate is: +" ("+ x1 +", " + y1 +")
  ";
  document.getElementById("corridnate").innerText = " The first corridnate is: +" ("+ x2 +", " + y2 +")
  ";
}

function getslope(a, b, c, d) {
  document.getElementById("slope").innerHTML = " The slope is: +" (d - c) / (b - a);
}

function getmidpoint(a, b, c, d) {
  var e = (parseInt(a) + parseInt(b)) / 2;
  var f = (parseInt(c) + parseInt(d)) / 2;
  document.getElementById("corridnate").innerHTML = "The midpoint is :" + "(" + e + " , "
  f + ")";
}