If you want the CallablePoint()
constructor to return an object of type CallablePoint, then you can do something like this where the CallablePoint object contains a point as a property of the object, but remains a CallablePoint object:
function CallablePoint(x, y) {
this.point = {};
this.point.x = x
this.point.y = y
}
or, if what you're really trying to do is to make a function that returns you an object of CallablePoint, then you can create a factor function:
function CallablePoint(x, y) {
this.point = {};
this.point.x = x
this.point.y = y
}
function makeCallablePoint(x, y) {
return new CallablePoint(x,y);
}