I mean var p = new Point(Point._z)
You did not write very clearly so I am restating your problem.
I think that you want to be able to create Point object either by
specifying x and y or by specifying an existing Point object whose
values are to be used.
var p1=new Point(3,4);
var p2=p1;
If your question is how to have two different object constructors
and one is not just an object copy, use .arguments. See the code
below. I did not put error handling for the case of when the
signature is wrong.
***** Start of Code Section *****
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"
http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>2012-02-16: Multiple Signature Constructor</title>
</head>
<body>
<script type="text/javascript">
function Point()
{
switch (Point.arguments.length)
{
case 1: // Copy other object
this.x=Point.arguments[0].x;
this.y=Point.arguments[0].y;
break;
case 2: // x and y provided
this.x=Point.arguments[0];
this.y=Point.arguments[1];
break;
default: // Bad signature.
alert("ERROR");
}
}
p1=new Point(3,4);
alert("p1=("+p1.x+", "+p1.y+")");
p2=new Point(p1);
alert("p2=("+p2.x+", "+p2.y+")");
p3=new Point(1,2,3); // bad
p4=p1;
alert("p4=("+p4.x+", "+p4.y+")");
</script>
</body>
</html>
***** End of Code Section *****
Sincerely,
Gene Wirchenko