[I]
Constructor functions typically do not have return values. They initialize the object passed as the value of this and return nothing. However, a constructor is allowed to return an object value, and, if it does so, that returned object becomes the value of the new expression. In this case, the object that was the value of this is simply discarded.
Can someone explain what that meant?, and if it is what i think it means, then why isnt it applying to this?(why does it not assign 10 to rect1 and why does it still have the width value) :
[code]
<html>
<body>
<script>
function rectangle(w,h)
{
this.width=w;
this.height=h;
return 10;
}
var rect1 = new rectangle(10,20);
alert(“rect:”+rect1+”width:”+rect1.width);
</script>
</body>
</html>