JSFiddle - React, Tailwind, and code Playground

JavaScript

function Point(x, y){
   console.log("init", this);
   this.x = x;
   this.y = y;
   function loc(){
       return {x:this.x, y:this.y}     
   }
   this.loc = loc;
   function move(ox, oy){
     this.x += ox;
     this.y += oy;    
   }
   this.move = move;
}

var p = new Point(12, 12);

console.log(p.x, p.y, p.loc());
p.move(100, 100);
console.log(p.loc());