문제

As a corollary to this question, if you created an object in javascript using the syntax new (Date) how would you pass in any constructor args/params?

In other words is there an equivalent of new Date(2000) or is that just how you would do it?

도움이 되었습니까?

해결책

The parens return the result of the contained expression, so this will work:

new (Date)(2000);

This is the same as:

new Date(2000);

다른 팁

Have you tried: new (Date)(2000)? Not exactly pretty code...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top