OZONE Asylum
Forums
DHTML/Javascript
Instantiating a JavaScript object by calling prototype.constructor.apply
This page's ID:
30593
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
[b]liorean[/b]: Thanks for beautifully summing it all up in just a few paragraphs! Then we could probably say Number, Boolean and String syntactically look and work just like a C++-style cast -- SomeType(arg). Also, Object seems to be doing something interesting when used as a function; it will create a wrapper object, with the most appropriate class for the given argument: [code] Object(42).toSource() -> (new Number(42)) Object("hi").toSource() -> (new String("hi")) Object(false).toSource() -> (new Boolean(false)) [/code] I had never used JS classes as functions like this before. It has been a good find for me :) [url=http://magnetiq.com/][img]http://magnetiq.com/exports/oa_sig.gif[/img][/url] [small](Edited by [url=http://www.ozoneasylum.com/user/6682]MaGnA[/url] on 10-10-2008 06:14)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »