On May 6, 10:34 am, dhtml <dhtmlkitc...@gmail.com> wrote:

> var time = new (function(x){
>   this.timeStamp = +new Date;
>   this.end = new Date(x); // Invalid Date.
> })(Infinity);

How do you explain that both time.timeStamp and time.end are returned
without error in the following:

var time = new (function(x){
        this.timeStamp = + new Date;
        this.end = new Date(x); // Invalid Date.
})(1241646503107);
alert(time.timeStamp);
alert(time.end);

but the following results when no integer is entered:

1) (time) // invalid date, with no error
2) () // invalid date with no error
3) (time.timeStamp) // error
4) (time()) // error

REFERENCE:  
http://homepage.mac.com/moogoonghwa/practice/JavaScript/js_parentheticalOperator.html



Reply via email to