I am doing examples in "javascript: the Definitive Guide." For Example
8-1, a rectangle constructor function, how do I print/write the
rectagle (x,y)?
Here is the JavaScript program:
function Rectangle(w, h)
{
this.width = w;
this.height = h;
}
var rect1 = new Rectangle(2, 4);
var rect2 = new Rectangle(8.5, 11);
I tried to print "Rectangle (2,4)", by coding:
document.write("<h2>Rectangle</h2>");
document.write(rect1);
Previewing on FrontPage showed: Rectangle [object Object]
TIA,
Jeffrey