JSFiddle - React, Tailwind, and code Playground
JavaScript
function Point (x,y) {
this.x = x;
this.y = y;
this.findClosest = function(arr){
var absValueX, absValueY;
console.log(arr.x + " " + arr.y);
for (item in array) {
absValueX = Math.abs(item - this.X);
}
}
}
var p1 = new Point(5,6);
var p2 = new Point(6,7);
var p3 = new Point(10,15);
var p4 = new Point(-50,-89);
p1.findClosest(p2);